-->
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: many to many problem when have repeated cols in both tables
PostPosted: Wed Oct 31, 2007 1:57 pm 
Newbie

Joined: Wed Oct 31, 2007 1:13 pm
Posts: 1
i have 2 tables..

table1 - primary key(a, b)
table2 - primary key(a, c)

i need a many-to-many relationship to create a table3 with attributes a,b,c

table3 - primary key(a,b,c)

but the attribute 'a' exists in the both tables and hibernate give me an error like this -> Repeated column in mapping for collection

in a many-to-many relationship doesn't exists an insert="false" and an update="false" and i can't stop hibernate to try to create the same attribute 2 times.
----------------------------------

table1Mapping.hbm.xml

<hibernate-mapping package="...">
<class name="Table1" table="table1">

<composite-id name="table1Id" class="Table1Id">
<key-property name="a"/>
<key-property name="b"/>
</composite-id>

<set name="t1Table3" table="table3" inverse="true">
<key >
<column name="a" />
<column name="b" />
</key>
<many-to-many class="Table2" >
<column name="a" />
<column name="c" />
</many-to-many>
</set>
</hibernate-mapping>



table2Mapping.hbm.xml

<hibernate-mapping package="...">
<class name="Table2" table="table2">

<composite-id name="table2Id" class="Table2Id">
<key-property name="a"/>
<key-property name="c"/>
</composite-id>

<set name="t2Table3" table="table3">
<key >
<column name="a" />
<column name="c" />
</key>
<many-to-many class="Table2" >
<column name="a" />
<column name="b" />
</many-to-many>
</set>
</hibernate-mapping>

i put here an example of my mapping files.. maybe i have made a mistake somewhere..

so if this is possible, how i can solve this problem?

tanks for any help


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 12:57 pm 
Newbie

Joined: Wed Feb 13, 2008 10:28 am
Posts: 5
I´m facing the same problem. do you find a work arround for this issue ?


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.