-->
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: equals() and hashCode()
PostPosted: Sun Jul 03, 2005 6:28 pm 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
On the wiki page Equals and HashCode under Why are equals() and hashcode() important, it states "Hibernate works hard to prevent you from having to worry about [the fact that your objects are being moved out of memory]" and that "whenever you query for an object and find that particular object, Hibernate should return you that instance of the object. And Hibernate will do just that."

Okay, I know this is a stupid question, but I want to make sure I understand this. As I read this, it seems to me that this means that so long as I am within the same session my objects are loaded in, I do not have to override .equals() and .hashCode() (as far as hibernate is concerned that is). The only time I need to override these for hibernate's purposes is if I plan to detatch my objects from the session and then reuse them (perhaps with .update()) in another session.

Is my understanding correct?

Thanks so much, and sorry for the stupid question.[/url]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 03, 2005 9:03 pm 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
Yep.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 04, 2005 2:14 am 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
Thanks so much!


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.