-->
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.  [ 5 posts ] 
Author Message
 Post subject: Ordered list manipulation question
PostPosted: Wed Sep 10, 2003 5:37 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
If you have an ordered list (a <list> with a hibernate generated <index> column) is it necessary to get automatic ordering to work to add the object to that list explicitly?

Why I ask is that Parent/Children type of relationship where it is easier for me just to set the parent rather than add to the children, but in that case the ordering doesn't seem to function properly.

Is this expected behaviour or am I doing something wrong?

Thanks alot.

Matt


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 10, 2003 10:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please be a bit more explicit about what you are doing and what your mapping looks like.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 11:08 am 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
Sure Gavin. In this case the parent/child is a self join that looks like this:

<property name="order" column="CNT_CHILD_ORDER" type="int"/>

<many-to-one name="parent" column="CNT_PARENT_CONTENT_ID" class="blah.blah.Content"/>

<list name="children" lazy="true">
<key column="CNT_PARENT_CONTENT_ID"/>
<index column="CNT_CHILD_ORDER"/>
<one-to-many class="blah.blah.Content"/>
</list>

I originally had the list set as inverse and was just setting the parent, but this resulted in incorrect ordering (or no ordering at all). So my question is, for the ordering index column to be set properly by hibernate do I need to explicitly add the Content object to the list of children, or is simply setting the parent enough and hibernate will figure it out?

I appreciate the help.

Matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 11:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hibernate (and jdo, etc) don't implement "managed relationships" so yes, you need to adjust both ends.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 12:05 pm 
Beginner
Beginner

Joined: Wed Sep 10, 2003 5:34 pm
Posts: 36
Location: New York, NY
Ok, thanks for clearing that up.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.