-->
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.  [ 1 post ] 
Author Message
 Post subject: two one-to-many relations with the same class
PostPosted: Mon Feb 26, 2007 11:48 am 
Newbie

Joined: Wed Feb 07, 2007 7:42 am
Posts: 13
Location: Spain
Hello,

I've got a problem with bidirectional relations one-to-many/many-to-one.

The A class has got a list of elements from B class. And the C class has got a list of elements from B too.
One element of B class is relationed with A element or C element (XOR relation).

My solution is:





Code:

<class name="A"
table="A">
...
<list name="bs">
<key column="A_ID" not-null="true"/>
<list-index column="POSITION"/>
<one-to-many class="B"/>
</list>
</class>



<class name="B"
table="B">
...
<many-to-one name="As"
column="A_ID"
class="A"
not-null="true"
insert="false"
update="false"/>
....
<many-to-one name="Cs"
column="C_ID"
class="C"
not-null="true"
insert="false"
update="false"/>
</class>
</class>



<class name="C"
table="C">
...
<list name="bs">
<key column="C_ID" not-null="true"/>
<list-index column="POSITION"/>
<one-to-many class="C"/>
</list>
</class>




But this fails. The excpetion is:
Code:
Repeated column in mapping for entity: B column: POSITION (should be mapped with insert="false" update="false")



Any suggestion?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.