I am not able to embed the Address into Person. Controller and views are auto generated. When I click on create I just get a blank page instead of proper UI of grails.
package trydemo
class Person {
String name
Address address
static embedded = ['address']
static constraints = {
}
}
package trydemo
class Address {
String city
static constraints = {
}
}
Assuming you are using GORM For Hibernate, the code you show is correct and is how you use
embeddedin Grails 3.3.11 (or any other version).The effect of using
embeddedin that way is theAddressproperties will be stored in the same table as thePersonproperties so when you retrieve aPerson, there is no join or foreign key involved. All of the data to make aPersonis in 1 row in 1 table.Separate from that, you can organize your UI however you like.