-->
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-index from the child side
PostPosted: Wed Sep 14, 2005 5:01 am 
Newbie

Joined: Fri Sep 02, 2005 12:47 pm
Posts: 14
Location: muenchen
I use one-to-many mapping of parent child like structure. To store children objects it use list.

/parent/

<list name="array"
inverse="true"
cascade="all,delete-orphan">

<key column="PARENT_ID"/>
<list-index column="listnumber"/>
<one-to-many class="child"/>
</list>


/child/


<many-to-one
name="parent"
column="PARENT_ID"
class="parent"
not-null="true" />


The "listnumber" filed is not mapped in child.

The problem is that listnumber is saved always as a null into db so it can not recreate list object properly from db.
My intension was that position in the list transvers into listnumber value and vice versa.
I belive I missing smth on the child side. Can be that listnumber has to be mapped as a key.

Sincerely,

Pawel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 6:57 am 
Newbie

Joined: Fri Sep 02, 2005 12:47 pm
Posts: 14
Location: muenchen
... I think I got the answere.

proper mapping should looks like

/parent/

<list name="array"
cascade="all,delete-orphan">

<key column="PARENT_ID"/>
<list-index column="listnumber"/>
<one-to-many class="pdbCode"/>
</list>


/child/

<many-to-one
name="parent"
column="PARENT_ID"
class="project"
not-null="false"
insert="false"
update="false" />


For some reason invers="true" is not working with list. Maybe it would be fixed in new version of hibernation.

Sincerely,

Pawel


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.