-->
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: one to many mapping
PostPosted: Tue Dec 29, 2009 4:24 pm 
Newbie

Joined: Thu Nov 12, 2009 4:32 pm
Posts: 16
i have a Class A and Class B,relation between these two are ONE(Class A)-To-MANY(Class B)

1)Class A is having

private Long identityId
private Long userId
private Set<Class B> setb = new HashSet<Class B>();

below is the content of classa.hbm.xml

<class name="ClassA" table="table_a">
<id name="identityId" column="identify_id"></id>
<property name="userId" column="user_id"></property>
<set name="setb" lazy="false" inverse="false">
<key column="user_id"></key>
<one-to-many class="ClassB"/>
</set>
</class>

2)Class B is having

private Long userId;
private Long respId;

below is the content of classb.hbm.xml

<class name="ClassB" table="table_b">
<id name="userId" column="user_id"></id>
<property name="respId" column="resp_id"></property>
</class>


I am trying to pull Class B data but its coming as NULL , Can some one let me know if there is any wrong with above mappings ?


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.