-->
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 with composite key
PostPosted: Thu Aug 06, 2009 11:47 am 
Newbie

Joined: Thu May 14, 2009 4:19 am
Posts: 12
Hello,
I was wondering how you would write the mapping file for a one-to-many with a copmosite key.

I have the following mapping file...
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >
<class name="StaticData.Product, StaticData" table="v_Products"
lazy="false">
<composite-id>
<key-property name="Id" column="Id" type="string" ></key-
property>
<key-property name="MarketId" column="MarketId" type="string"></
key-property>
</composite-id>
<property name="Currency" column="CurrencyId" />
<property name="Description" column="Description" />
<property name="DisplayName" column="DisplayName" />
<bag name="SubProduct" table="tbl_SubProduct" lazy="false" order-
by="Index" >
<key column="Id" property-ref="Id"/>
<one-to-many class="StaticData.SubProduct, StaticData"/>
</bag>
</class>
<resultset name="AllProduct">
<return alias="Product" class="StaticData.Product, StaticData" />
</resultset>
<sql-query name="GetProducts" resultset-ref="AllProduct" >
exec p_GetProductsById :StoreId
</sql-query>
</hibernate-mapping>

How do you configure a composite key for bag. The config only allows
key element not composite key for bag element.

thanks


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.