-->
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: idbag
PostPosted: Sat Apr 11, 2009 12:50 am 
Newbie

Joined: Sat Oct 11, 2008 7:28 am
Posts: 10
Location: New Delhi (INDIA)
Hi friends,

I have mapped the Order class which also includes collection of products.
within same mapping file I also have mapped products as idbag.

My requirement is that when I am retrieveing order the product's ids (primary keys) are not getting available.

Part of Mapping documents:
Code:
<idbag name="products" table="products">      
       <collection-id type="long" column="PRODUCT_ID">
       <generator class="increment">
       </generator>
       </collection-id>
      <key column="ORDER_ID" not-null="true"></key>       
       <composite-element class="com.raisonne.billsmart.GeneralPOs.JobPO">
         <property name="productName" column="PRODUCTNAME" type="java.lang.String"/>


I need the value of "PRODUCT_ID" field for each product object in variable "productId".

Any guidance regarding this issue is highly appriciated.

_________________
Thanks,
Arun


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 12, 2009 12:45 am 
Regular
Regular

Joined: Thu Sep 06, 2007 2:22 am
Posts: 108
Location: Noida,India
You are mapping you Product class as a Value type, and <collection-id.../> element just give you functionality to insert the surrogate key without mapping a class as Entity type, but you can't map any property of class with this.

So with current mapping you can't achieve what you want.

you can map Product class a a entity type and then you can access the primary key of the product table.


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.