-->
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: hibernate composite primary key as foreign key
PostPosted: Fri Feb 17, 2006 1:56 pm 
Newbie

Joined: Wed Feb 08, 2006 7:49 pm
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.3

Name and version of the database you are using: Mysql,
driver-3.1.10


I am using Middle gen to generate mapping files
(Just giving a simpler example, will provide mapping files if needed)
Tables

Quote:
Table AA

a - PK
a1
a2


Table BB
a - PK,FK(AA-a)
b - PK
b1
b2

Table CC
c - PK
c1
c2

Table ABC
a - PK,FK(BB-a)
b - PK,FK(BB-b)
c - PK,FK(CC-c)
abc1
abc2


Middlegen warning
Quote:
1. There is a relation between ABC and BB that doesn't include all the primary key columns.
This may cause errors later on.
2. The BB table's primary key consists of 2 columns, but one of the relationships uses 1 foreign keys.
That is not a well-defined relationships, as all columns in a primary key (and only primary key columns)
should be referenced by a foreign key (all columns in the foreign key).


Exception
Quote:
org.hibernate.MappingException: Foreign key (FK4E8A699D77159AE6:ABC [b])) must have same number of columns as the referenced primary key (BB [a,b])


It looks to me that the relation ships are all fine, any help would be greatly appreciated.

Thanks in advance.


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.