Changing the data type of the [hasMany:] reference to a list?

做~自己de王妃 提交于 2019-12-06 11:24:16
Dónal

As described in section 5.2.4 of the Grails manual, this is the correct way to make the collection a List.

I suspect the problem is that by default the constraint nullable(false) is applied to all domain class properties and you're trying to save a null value for this property. To fix this, add a constraint that allows this property to be null (if that's what you want

List myList
static constraints = {
    myList(nullable: true)
}

Alternatively, make sure that the property is not null before the object is validated/saved.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!