schmeling wrote:
> 
> 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.
> 

I'm not sure that is a good idea. When an object is created, before it is
persisted, it doesn't have an id. When saving the id is assigned, i.e. it is
changing. Read more about how we solved it in Sculptor:
http://www.fornax-platform.org/cp/display/fornax/3.+Advanced+Tutorial+(CSC)#3.AdvancedTutorial(CSC)-Key

-- 
View this message in context: 
http://www.nabble.com/Hibernate-Cartridge%28CHB%29-Equals-Hashcode-ToString-tp20830500s17564p20910574.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