-->
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: Mapping of hierarchy and order of elements
PostPosted: Wed Nov 17, 2004 4:46 am 
Newbie

Joined: Tue Nov 16, 2004 5:39 am
Posts: 3
Hi all,

thank you for your interesting answers yesterday. I reconsidered my car example and created real instances from the following XML-file (Car, Tyre, Seat ..)

<cars>
<car name="car1">
<tires>
<tyre> One </tyre>
<tyre> Two </tyre>
<tyre> Three </tyre>
<tyre> Four </tyre>
</tires>
<seats>
...
</seats>
...
</car>
<car name="car2">
...
</car>
...
</cars>


Given the existing db-schemas

TABLE CarHierarchy ( ID int, PARENT int, CHILD int )
TABLE CarOrder ( ID int, PREVIOUS int, NEXT int )
TABLE TyreOrder ( ID int, PREVIOUS int, NEXT int )

how do I create a mapping in Hibernate that preserves the hierarchy AND the order (recursivly) of the cars, tyres, seats..?

I looked at Ch. 16 of the Reference (parent/child), but how do I preserve the order of the elements together?

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 17, 2004 4:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
by adding/using something to order by!

Either the id or maybe add a sequence number if proper sequence is important for you.

_________________
Max
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.  [ 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.