Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Not A Bug
-
Affects Version/s: 1.0.2
-
Fix Version/s: None
-
Component/s: Persistence
-
Labels:None
Description
The user guide (5.5.2.1 section Many-to-Many Mapping) states that the default names for
class Group {
...
static hasMany = [people:Person]
}
class Person {
...
static belongsTo = Group
static hasMany = [groups:Group]
}
will be person_id and group_id.
This is not the case. The name of the colelctions are used for the column name. In this case the names will be: people_id and groups_id.
Or this is a bug or the documentation is wrong.
I prefer the naming as described in the documentation.
Issue Links
| This issue duplicates: | ||||
| GRAILS-828 | many-to-many obviously stores relations in wrong columns |
|
|
|
Note that you can use the custom ORM mappings to workaround this:
class Group {
...
static mapping = { people column:'person_id' }
}
class Person {
...
static mapping = { groups column:'group_id' }
}