[jboss-dev-forums] [EJB3 Development] - Re: Entity hashCode and equals overriding
Piotr Nowicki
do-not-reply at jboss.com
Sat Jan 5 12:41:01 EST 2013
Piotr Nowicki [https://community.jboss.org/people/pedrokowalski] created the discussion
"Re: Entity hashCode and equals overriding"
To view the discussion, visit: https://community.jboss.org/message/787951#787951
--------------------------------------------------------------
This is really weird Fabio.
So you have a Map<Book, Integer> with one element - entry1 which key hashCode yields to 1 and equals always returns true.
Then you have a Book instance - b1 which hashCode yields to 1 and equals always returns true.
In this way you ask the Map<Book, Integer> for an entry with key b1. The hashCode == 1, so the bucket in the map is located correctly; the equals always returns true, so the element must be properly returned...
Can it be some caching problem between you changing the code, deploying it on the server and running again?
Saying it all - it seems like a problem not related with the JPA / persistence / database.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/787951#787951]
Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2030]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130105/1f6191d2/attachment.html
More information about the jboss-dev-forums
mailing list