-->
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: Help with many-to-many
PostPosted: Tue May 03, 2005 2:34 pm 
Newbie

Joined: Tue May 03, 2005 2:24 pm
Posts: 3
Hello,

I have a simple many-to-many mapping defined and the query seems to work fine but the setters for the setChild(Collection col) is getting an empty collection.

Tables are :
Parent , Parent_child_link, Child.

Config files for Parent

Code:
<class mutable="false" name="Parent" table="Parent" >

       <property name="name" column="NAME" type="string" length="55" not-null="true"/>
       <property name="description" column="DESCRIPTION" type="string" length="255"/>
      ....
      ...
      ..
   <set name="child" inverse="false" table="parent_child_link" outer-join="false">
          <key column="parent_id" />          
          <many-to-many class="child" column="child_id"/>             
       </set>
       ...
       ..       
       


I have debug statements in the child and the object is getting created, it is not being added to the collection.

Does anybody know what the issue is.

_________________
Srikanth


Top
 Profile  
 
 Post subject: Fixed --
PostPosted: Tue May 03, 2005 4:33 pm 
Newbie

Joined: Tue May 03, 2005 2:24 pm
Posts: 3
I found the problem, I forgot to override equals and hashcode for UserTypeKey that I had defined for Objects.

Silly me...

Thanks

_________________
Srikanth


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.