-->
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.  [ 1 post ] 
Author Message
 Post subject: Equals method not working
PostPosted: Fri Jul 28, 2006 9:06 am 
Newbie

Joined: Fri Jun 09, 2006 8:03 am
Posts: 12
Hibernate version: 3.2

For background, I am using a long session pattern.

Well, I have a class Item that has just an id and a name. I wrote an equals method that just compares the name, since that is the business key. The method works fine for when it is transiet. However if I use a DAO to retrieve the same item twice, invoking the equals method on those two objects returns flase. In fact loading one object and comparing it to itself returns false. If I use the == it returns true, but I expected that since the long session will return the same instance from cache.

I know this is a problem dealt with before, but the answer to those was to not use the id field. Well I am not using it, so what is the problem?


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

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.