-->
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.  [ 3 posts ] 
Author Message
 Post subject: list, one-to-many and intervening collection table
PostPosted: Tue Oct 25, 2005 10:55 am 
Newbie

Joined: Tue Oct 25, 2005 10:40 am
Posts: 3
Hibernate version: 2

Hi,
I have mappings:
<class name="parent">
...
<list name="children" table="child" cascade="all">
<key column="PARENT_ID"/>
<index column="number"/>
<one-to-many class="child"/>
</list>
</class>

<class name="child">
...
<property name="number" column="number"/>
</class>

I want to have just two tables in DB. Without intervening collection table for childrens.
The only way I know I am able to do it is through <composite-element ..> in parent's children list mapping - change child with such composite.

Using <set> for children there is no such problem. But I'm loosing <index> element. I insist using list here but only with parent <-> child tables, not parent <-> children <-> child tables.
I hope the problem is clear.
Do you have any suggestions?

Cheers,
Maciek


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:12 pm 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:57 pm
Posts: 48
Location: Los Angeles, CA
Have you tried a child table like this?

Code:
id  |  parent_id  |  index  |  name  | ...
----+-------------+---------+--------+-----------


jd


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 6:06 pm 
Newbie

Joined: Tue Oct 25, 2005 10:40 am
Posts: 3
thanks for reply. yup I tried this stuff. but the problem was in my sql table definition. I've had not null field constraint in key table. so oracle transaction stuff wouldn't work with this. now it is ok.
thanks anyway!
-
Maciek


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