-->
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: Dependendent object not loading anymore
PostPosted: Fri Nov 30, 2007 8:50 am 
Newbie

Joined: Fri Nov 30, 2007 8:36 am
Posts: 4
I had an object/table called Form with a 1 column primary key. Another table/object called Recipient had a compound primary key with one of those primary keys being a foreign key reference to the Form primary key. When I did HQL to load up an array of Forms, session.createQuery("from Form"), it loaded all the Recipients into a Recipient Set. I changed Form to have a compound primary key and use both of those keys in a Recipient compound key. Now the query call doesn't load the Recipient Set?! What am I missing?
I've included the Form and Recipient hbm.xml files.
Thanks,
Mike

************** FORM *************************
hibernate-mapping>
<class name="com.skywiresoftware.db.Form" lazy="false" schema="PUBLIC" table="FORM">
<composite-id name="compId" class="com.skywiresoftware.db.FormPK">
<key-property name="config" type="string" column="CONFIG" length="50"/>
<key-property name="formname" type="string" column="FORMNAME" length="50"/>
</composite-id>
<property name="category" type="string" column="CATEGORY" length="50"/>

........

<set name="recipientsSet" lazy="true">
<key>
<column name="FORMNAME" />
<column name="CONFIG" />
</key>
<one-to-many class="com.skywiresoftware.db.Recipient" />
</set>
</class>
</hibernate-mapping>

******************** RECIPIENT ********************
<hibernate-mapping>
<class name="com.skywiresoftware.db.Recipient" lazy="false" schema="PUBLIC" table="RECIPIENT">
<composite-id name="compId" class="com.skywiresoftware.db.RecipientPK">
<key-property name="config" type="string" column="CONFIG" length="50"/>
<key-property name="formname" type="string" column="FORMNAME" length="50" />
<key-property name="name" type="string" column="NAME" length="50"/>
</composite-id>
<property name="description" type="string" column="DESCRIPTION" length="50"/>
<property name="recCount" type="integer" column="REC_COUNT"/>

<many-to-one name="form" class="com.skywiresoftware.db.Form" update="false" insert="false" lazy="false">
<column name="FORMNAME" not-null="true" length="50"/>
<column name="CONFIG" not-null="true" length="50"/>
</many-to-one>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: hello?
PostPosted: Mon Dec 03, 2007 10:56 am 
Newbie

Joined: Fri Nov 30, 2007 8:36 am
Posts: 4
Anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 03, 2007 1:05 pm 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

Let us analyze the problem, try to intialize your child object manually..as below.
List forms = session.createQuery("from Form")
Take one object from the list and try to get the child objects using,
Hibernate.intialize(form.getRecipients()); Check to see whether the child object is loaded.

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.