Entities equals(), hashCode() and toString(). How to correctly implement them?

Posted by spike07 on Stack Overflow See other posts from Stack Overflow or by spike07
Published on 2010-03-15T11:05:48Z Indexed on 2010/03/15 13:59 UTC
Read the original article Hit count: 302

Filed under:
|
|
|
|

I'm implementing equals(), hashCode() and toString() of my entities using all the available fields in the bean.

I'm getting some Lazy init Exception on the frontend when I try to compare the equality or when I print the obj state. That's because some list in the entity can be lazy initialized.

I'm wondering what's the correct way to for implementing equals() and toString() on an entity object.

© Stack Overflow or respective owner

Related posts about java

Related posts about entity