-->
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: List collection not filling in "child" reference f
PostPosted: Thu Oct 16, 2003 5:23 pm 
Newbie

Joined: Wed Oct 15, 2003 4:31 pm
Posts: 17
Howdy,

I'm trying to create an ordered parent/child relation using a list collection (I need to keep the items in order and list seemed the way to go).

I can basically get it to work - when I save the "parent", hibernate saves it and persists the "children" that I've added to the parents list/collection property. So I'm pretty sure I'm in teh ballpark.

However, the two "key" fields that link the child back to the parent are not being filled in. The column for the key and index are being left null/empty.

Here's an extract of the parent HBM file

<class
name="SOpen.spm.dao.StudentRoot"
table="student_base"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="primaryKey"
column="primary_key"
type="int"
unsaved-value="0"
>
<generator class="sequence">
<param name="sequence">hibernate_sequence</param>
</generator>
</id>

<version
name="recordVersion"
type="int"
column="record_version"
/>

<list
name="snapshotList"
table="Student"
lazy="false"
inverse="true"
cascade="all"
>

<key
column="root_key"
/>

<index
column="snapshot_order"
/>

<one-to-many
class="SOpen.spm.dao.Student"
/>
</list>

There is a column called "root_key" and "snapshot_order" in the child table (which is represented by the Student object that is persisted to it).

The logic (which is very simple right now - open session/transaction, create a parent, create a child, put child in parents list, save(), commit, close) seems to work - no errors of funny messages. And all other values for the parent and child objects are correctly persisted.

I'm using Postgreqsl (if that helps at all).

Any ideas of what to look for next?

Thanks!

Gerry


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 10:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
As you have not posted any of the driver code perfoming this, I can only assume that you are not setting the parent's value on the child. This is all covered in the docos on Parent/Child relationships.

http://www.hibernate.org/hib_docs/reference/html/parent-child.html#parent-child-bidir


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.