-->
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: How to map Arraylist in HBM
PostPosted: Wed Apr 13, 2011 1:27 am 
Newbie

Joined: Tue Apr 12, 2011 6:14 am
Posts: 2
I have a Master table CamapTable which has list of marketID from a table called MarketIDrelation

The key of the table is MarketIDrelation is detailsID from CamapTable and marketID from MarketIDrelation

How should I write hbm for the both which will map to this list.


Top
 Profile  
 
 Post subject: Re: How to map Arraylist in HBM
PostPosted: Wed Apr 13, 2011 2:17 am 
Regular
Regular

Joined: Fri Nov 12, 2010 4:13 am
Posts: 81
Location: India
anushka.vaze wrote:
I have a Master table CamapTable which has list of marketID from a table called MarketIDrelation

The key of the table is MarketIDrelation is detailsID from CamapTable and marketID from MarketIDrelation

How should I write hbm for the both which will map to this list.





<class name="NAME_OF_PARENT_CLASS" table="PARENT_TABLE_NAME">
<id name="PARENT_ID">
<generator class="sequence">
<param name="sequence">NAME_OF_SEQUENCE_OF_PARENT_TABLE</param>
</generator>
</id>

<bag name="NAME_OF_LIST_USED_IN_PARENT_CLASS" cascade="all" >
<key column="NAME_OF_JOIN_ID"/> // Note: ID on which you are joining two tables
<one-to-many class="NAME_OF_CHILD_CLASS"/>
</bag>
<property name="xyz" column="xyz" type="java.lang.String"/>
All properties of parent tables will go here

</class>

<class name="NAME_OF_CHILD_CLASS" table="CHILD_TABLE_NAME">
<id name="CHILD_ID">
<generator class="sequence">
<param name="sequence">NAME_OF_SEQUENCE_OF_CHILD_TABLE</param>
</generator>

</id>

<property name="xyz" column="xyz" type="java.lang.String"/>
All properties of child tables will go here
</class>

Hope it will help you

_________________
Thanks & Regards,
Chirag


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.