Normally member(property) would be mapped as a parent-child relationship, but uses embedded would be mapped as a one table.
Example:
Person has a Address object.
1 2 3 4 5 |
class Person { Address homeAddress Address workAddress static embedded = ['homeAddress', 'workAddress'] } |
And Address class is like below.
1 2 3 4 |
class Address { String number String code } |
Declare as a embedded property, Person table mapped as below.
- id
- home_address_number
- home_address_code
- work_address_number
- work_address_code
Each column names are concatenated with _(an underscore) and the parent object name and the child object name.
http://grails.org/doc/latest/guide/GORM.html#gormComposition