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.
|