-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Why must one override equals() and hashcode() if comp-key?
PostPosted: Wed Feb 16, 2005 4:38 pm 
Newbie

Joined: Wed Sep 22, 2004 12:18 pm
Posts: 14
The docs just say you must do it, and doesn't really explain why? Is this just a implementation limitation of Hibernate, or is their a more profound reason for this? I mean, why can't the Hibernate framework have a default implementation
of the equals() and hashcode() methods in a composite-key scenario, just like it does for a single key? Why leave it up to the user to make sure that the xml mapping file matches the implementaions of these methods?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 6:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Object identiy issues can apply to non-composite key as well but it is a huge issue for composite keys. I suggest you read http://hibernate.org/109.html for a more detailed explanation.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.