Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.1-beta3
-
Component/s: Persistence
-
Labels:None
-
Environment:grails 1.0.3/linux
Description
A one-to-many relationship with a composite primary key in the parent is unable to construct the foreign key from the child to the parent
class Parent implements Serializable {
static mapping = {
id composite:['col1', 'col2']
}
static hasMany = [ children : Child ]
String col1
String col2
}
class Child {
static belongsTo = [ parent : Parent ]
}
Starting the application returns the following error:
... nested exception is org.hibernate.MappingException: Foreign key (FK5A3F51C976A59A:child [parent_id])) must have same number of columns as the referenced primary key (parent [col1,col2]):
org.hibernate.MappingException: Foreign key (FK5A3F51C976A59A:child [parent_id])) must have same number of columns as the referenced primary key (parent [col1,col2])
Issue Links
| This issue is duplicated by: | ||||
| GRAILS-3857 | composite key breaks simple references |
|
|
|
I am getting this problem with 1.1-beta2 also. This is a major headache for me...