-->
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: Hibernate mapping : Parent ->BoyChldrn, Parent ->BabyChldrn
PostPosted: Wed Aug 04, 2010 3:16 am 
Newbie

Joined: Thu Mar 22, 2007 12:48 am
Posts: 7
Location: Delhi
Hi all,

I'm facing problem to create mapping based on the following scenario.

Parent
----------------
Id -> long
name -> varchar

Child
-----------------
Id -> long
name -> varchar
parent_id -> long
gender -> short [1-for male, 2 for female]

Now from parent entity object want to get babyChildren [set/list] and boyChildren [set/list].

Please suggest How I could achieve my goal?


-Shyam


Last edited by me_sss on Fri Aug 06, 2010 3:06 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Hibernate mapping : Parent ->BoyChldrn, Parent ->BabyChldrn
PostPosted: Wed Aug 04, 2010 10:39 am 
Newbie

Joined: Thu Mar 22, 2007 12:48 am
Posts: 7
Location: Delhi
I want something like below, Is it possible? Please suggest how can I do this.


Code:
# <class name="Parent">   
# <id name="id">   
# <generator class="sequence"/>   
# </id>   
# <property name="name" column="name"/>   
# <set name="boyChildren" table="child">   
# <composite-key>   
# <property column="parent_id"/>   
# <property column="gender" value"male"/>   
# <composite-key>   
# <one-to-many class="Child" column="id"/>   
# </set>   
# <set name="babyChildren" table="child">   
# <composite-key>   
# <property column="parent_id"/>   
# <property column="gender"/ value="female">   
# </composite-key>   
# <one-to-many class="Child" column="id"/>   
# </set>   
# </class>   


Last edited by me_sss on Fri Aug 06, 2010 3:12 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Hibernate mapping : Parent ->BoyChldrn, Parent ->BabyChldrn
PostPosted: Fri Aug 06, 2010 3:08 am 
Newbie

Joined: Thu Mar 22, 2007 12:48 am
Posts: 7
Location: Delhi
Does anybody not know that the above is possible or not? or any other alternative way to achieve the same?


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.