wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Foreign Key Must Have the Same Number Of Columns As the Referenced Primary Key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Foreign Key Must Have the Same Number Of Columns As the Referenced Primary Key" Watch "Foreign Key Must Have the Same Number Of Columns As the Referenced Primary Key" New topic
Author

Foreign Key Must Have the Same Number Of Columns As the Referenced Primary Key

Lakshmeepathi Ghiree Anandh
Greenhorn

Joined: Sep 04, 2012
Posts: 5


I get the following error when <one-to-many>(Set) is used on a table with a composite-id. i.e when TYPE_ID in CALL_CENTER_TYPE_ASSOC table ,is not a part of composite-id, <one-to-many>(Set)
works.

Though it is <many-to-many>,I ll have only one object of CALL_CENTER_TYPE_ASSOC at a time.So,I thought <one-to-many> will retrieve multiple rows from
IM_CTIS_WORKFLOW_ASSOC.It worked when the column was not a part of composite-id.

I DO NOT HAVE THE COLUMN "CALL_CENTER_ID" AND I CANNOT ADD IT TO THE TABLE "IM_CTIS_WORKFLOW_ASSOC"

How do I get the same functionality when TYPE_ID is a part of composite-id? Please help. Thanks in advance.





Foreign key (FKDB7E233EB70B075B:IM_CTIS_WORKFLOW_ASSOC [TYPE_ID])) must have same number of columns as the referenced primary key (CALL_CENTER_TYPE_ASSOC [TYPE_ID,CALL_CENTER_ID])







 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Foreign Key Must Have the Same Number Of Columns As the Referenced Primary Key
 
Similar Threads
Map an object that has composite id containing a mapping to object that itself has composite id?
Problem with mapping
Foreign Key Constraint Fails
Help with mapping set - Hibernate
Hibernate Mapping (Many-To-One Association). Problem. This forum is my last hope.