-->
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.  [ 3 posts ] 
Author Message
 Post subject: Do I have to implement equals() and hashcode()?
PostPosted: Mon Feb 27, 2006 5:46 am 
Newbie

Joined: Mon Feb 27, 2006 5:22 am
Posts: 2
Location: Italy
Hibernate version: 3.1.2

Hello,
I'm new to Hibernate and I have a question about model beans.

I'm writing an application using natural keys as id, so the id of new beans is not automatically generated by Hibernate.

I've read somewhere that I have not to redefine equals and hashcode methods if the ids are not automatically generated by Hibernate.

Is this correct?

Thanks in advance,
Davide.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 27, 2006 6:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
search for equals hashcode on our wiki and read that article.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 27, 2006 9:41 am 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
This brief post might help too... I had a bit of trouble following all the different situations at first. The first question you need to ask is whether you plan to deal with detached persistent objects.

After that, things get murky and aggravating, but a little experimentation and study will get you to the point of knowing the practical issues.

http://forum.hibernate.org/viewtopic.ph ... highlight=


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.