1
를 설정하지 않습니다 난 상태 속성에 대한 다음 지침을Grails의 도메인 속성 DEFAULTVALUE 도메인의
static mapping={
status defaultValue="NNE"
}
static constraints={
status(nullable:false, inList:["NNE","NMO","NJE"])
}
하지만 도메인 개체의 새 인스턴스를 만들 때, 상태는 오히려으로 설정보다 널 태만.
def instance=new Ticket();
println instance.status;// this is NULL instead of the default "NNE"
이 경우입니까?
Grails 3 및 MySQL에서 작동하지 않습니다. Grails 외부에 행을 삽입 할 때 Default 값이 올바르게 설정됩니다. Grails에서는 값이 NULL입니다. – Guus