Thanks for your response.

Darius Jockel wrote:
> 
> The hashcode and equals should be derived from an unmutable subset of the
> attributes of an entity.
> 
That's true it must be unique, not nullable and immutable.

Darius Jockel wrote:
> 
> Therefore this subset has to be declared as <<NaturalKey>>.
> 
I don't think so. Also surrogate keys like the implicitly generated id
attribute of entities are candidates for the implementation of hashcode and
equals method. So if there is no natural key we have to override equals and
hashcode using the id attribute for equals compare and calling the hashcode
method. Otherwise two entities with the same identifier will not be equal
nor have they the same hashcode.


-- 
View this message in context: 
http://www.nabble.com/Hibernate-Cartridge%28CHB%29-Equals-Hashcode-ToString-tp20830500s17564p20904301.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to