-->
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: Query works, but access by composite-id does not
PostPosted: Tue Aug 09, 2005 7:10 pm 
Newbie

Joined: Tue Aug 09, 2005 7:02 pm
Posts: 7
I have an object (Assortment) that has a one-to-many relation to another one (AssortmentSlot). The object has a composite-id which needs 3 attributes.

When I load the Assortment object using the following code, the data is filled but the Set for the AssortmentSlots is empty:
Code:
        Assortment t = new Assortment();
        t.setAssortNo(new Integer(80));
        t.setClientBpCd("0009");
        t.setClientOdsCd("V");
        t = (Assortment) sess.load(Assortment.class, t);



When I load the Assortment with a query using this code, everything works fine and also the set of AssortmentSlots is filled.
Code:
        Query q = sess.createQuery("from Assortment a where a.AssortNo = 80 and a.ClientBpCd = '0009'  and a.ClientOdsCd = 'V'");
        List res = q.list();
        Assortment t = (Assortment)res.get(0);



Any ideas?
Thanks, Marcus


Hibernate version:
3.0.5

Mapping documents:
<hibernate-mapping package="de.arvatologistics.rim.db">
<class name="Assortment" table="c_assrt_v2">
<composite-id>
<key-property name="AssortNo" column="assort_no" type="java.lang.Integer"/>
<key-property name="ClientBpCd" column="client_bp_cd" type="java.lang.String" />
<key-property name="ClientOdsCd" column="client_ods_cd" type="java.lang.String" />
</composite-id>

<property name="AssortDc" column="assort_dc" type="java.lang.String" not-null="true" />
<property name="AssortTyCd" column="assort_ty_cd" type="java.lang.String" />
<property name="DlvyDt" column="dlvy_dt" type="java.util.Date" />
<property name="FromDt" column="from_dt" type="java.util.Date" />
<property name="Rem" column="rem" type="java.lang.String" />
<property name="ToDt" column="to_dt" type="java.util.Date" />
<property name="StCd" column="st_cd" type="java.lang.String" not-null="true" />
<property name="CUid" column="c_uid" type="java.lang.String" not-null="true" />
<property name="CDt" column="c_dt" type="java.util.Date" not-null="true" />
<property name="UUid" column="u_uid" type="java.lang.String" />
<property name="UDt" column="u_dt" type="java.util.Date" />
<property name="SusyTxCd" column="susy_tx_cd" type="java.lang.String" />
<property name="RecStat" column="rec_stat" type="java.lang.Short" not-null="true" />

<set name="slots">
<key>
<column name="assort_no"/>
<column name="client_bp_cd"/>
<column name="client_ods_cd"/>
</key>
<one-to-many class="AssortmentSlot"/>
</set>

<many-to-one name="module" class="Module" insert="false" update="false">
<column name="mod_no"/>
<column name="client_bp_cd"/>
<column name="client_ods_cd"/>
</many-to-one>

</class>
</hibernate-mapping>
Code:


Top
 Profile  
 
 Post subject: hello??
PostPosted: Fri Sep 30, 2005 7:16 am 
Newbie

Joined: Tue Aug 09, 2005 7:02 pm
Posts: 7
Does anybody have an idea? Please answer.


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.