-->
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: many-to-many association between two tables
PostPosted: Mon Dec 18, 2006 6:46 am 
Newbie

Joined: Mon Jun 27, 2005 7:43 am
Posts: 13
Location: Barcelona, Spain
Hibernate version: 3.1.3

Hi forum,

The problem is quite simple, and I hope the solution will be too ;)

I have 2 tables
TABLE_1 with a primary key made of columns A, B and C
TABLE_2 with a primary key made of columns A, B and D

I would like to map a many-to-many association between both tables using columns A and B (no need to have it bidirectionnal), but the problem is that so far I obviously always run into "Foreign key must have same number of columns as the referenced primary key", since I don't have column D in TABLE_1 nor column C in TABLE_2, to make one's foreign key match the other's primary key.

Creating an association table is not an option in my case, and I know the reason of the problem is a poor design of the database...

However, if anyone has ever ran into this situation, and found a solution, it would be most welcome!

Thanks,
alexis


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.