Following the GORM docs I tried to use the following domain class with Grails 2.2.1:
package grailscompositiontest
class ScafPerson {
String name
ScafAddress homeAddress
ScafAddress workAddress
static constraints = {
name(nullable: false, blank: false)
}
static embedded = ['homeAddress', 'workAddress']
}
class ScafAddress {
String number
String code
}
The controller just uses scaffolding:
package grailscompositiontest
class ScafPersonController {
static scaffold = true
}
Unfortunately this does not work, it triggers a server error as soon as I browse to the "create" view:
URI: /GrailsCompositionTest/scafPerson/create
Class: java.lang.NullPointerException
Message: Cannot get property 'id' on null object
Any idea what I am doing wrong?