-->
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.  [ 4 posts ] 
Author Message
 Post subject: Many2many relationship for 3 tables
PostPosted: Fri Feb 04, 2005 3:04 pm 
Newbie

Joined: Wed Sep 29, 2004 10:10 am
Posts: 13
Location: Washington D.C. USA
Hibernate version: 2.1
Name and version of the database you are using: Oracle 9i


Hi

I have 3 tables defined in Oracle database called, Table A, B and C. Each of them have primary key called a_id, b_id and c_id. There is a joint table defined called ABC which has composite key made up of 3 primary keys: a_id, b_id, c_id. There is no other column defined in table ABC. I am getting can not insert null exceptions while I am saving the object A.

Here are my definitions:

<table name="A" />
<table name="B" />
<table name="C" />


<many2many>
<tablea name="A" />
<jointable name="ABC" generate="false" />
<tableb name="B" />
</many2many>

<many2many>
<tablea name="B" />
<jointable name="ABC" generate="false" />
<tableb name="C" />
</many2many>

<many2many>
<tablea name="A" />
<jointable name="ABC" generate="false" />
<tableb name="C" />
</many2many>


Can anyone please tell me what is wrong and what are alternates ?

Thank you.
Ram Mahajan


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 3:27 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
map + index-many-to-many + collection

this is a ternary association

you can also use composite element

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: Re: Many2many relationship for 3 tables
PostPosted: Tue Jul 04, 2006 7:58 am 
Newbie

Joined: Tue Jul 04, 2006 7:52 am
Posts: 1
rmahajan wrote:
Hibernate version: 2.1
Name and version of the database you are using: Oracle 9i

Hi,

I am facing the same scenario. Have you found the solution for this. If so, please send us the same.

Thanks & Regards




Hi

I have 3 tables defined in Oracle database called, Table A, B and C. Each of them have primary key called a_id, b_id and c_id. There is a joint table defined called ABC which has composite key made up of 3 primary keys: a_id, b_id, c_id. There is no other column defined in table ABC. I am getting can not insert null exceptions while I am saving the object A.

Here are my definitions:

<table name="A" />
<table name="B" />
<table name="C" />


<many2many>
<tablea name="A" />
<jointable name="ABC" generate="false" />
<tableb name="B" />
</many2many>

<many2many>
<tablea name="B" />
<jointable name="ABC" generate="false" />
<tableb name="C" />
</many2many>

<many2many>
<tablea name="A" />
<jointable name="ABC" generate="false" />
<tableb name="C" />
</many2many>


Can anyone please tell me what is wrong and what are alternates ?

Thank you.
Ram Mahajan


Top
 Profile  
 
 Post subject: Same prob over here
PostPosted: Fri Nov 16, 2007 5:17 pm 
Newbie

Joined: Wed Nov 07, 2007 7:36 pm
Posts: 6
I have exactly the same problem over here. If anyone knows how to solve this it would greatly be appreciated ;-) .
One of the problems is the HashMap as it cannot contain equal keys. Therefore it is impossible to map this many-to-many.
Greetings and thanks in advance,
Jolliver


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