-->
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: Comparing 2 same objects...
PostPosted: Wed Jul 06, 2005 3:00 pm 
Newbie

Joined: Mon Jun 06, 2005 3:36 pm
Posts: 5
Hi,

New to NHibernate... so probably an easy one, but could not find it in the doc...

I have a persisted class that look-up one of it's value in another table. That looked-up table is also set-up as a class in NHibernate. On my form, I use a ComboBox, loaded with all the possible looked-up values so the user just pick the right one.

When I run this thing, it does not appear that the looked-up object (from the main class) does not equal to any one from the looked-up collection (even if it's value is there in the collection)... Obviously, it mean that the comparison is done on the object adress (or what-ever) and that there is two of the same value in memory.

I thougt that NHibernate would not create multiple copy of the same object, that once it was fetched from the DB (when I load it frist from my main class) it would actually not have to do much when I go fetch all the looked-up values to put it in the ComboBox, that it would just have to get the one that have not been fetched so far based, say, on the PK value...

Most probably I did not set-up something properly. I would appreciate a pointer to where I could get the proper information on how I could do this.

Many thank's in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 12, 2005 2:25 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
Look in the doc where it talks about overriding Equals and Hashcode.

BOb


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.