我有一個案例,驗證是在域屬性上完成的,但不在關聯(hasMany)屬性上。Grails域已擁有多個驗證
是否有任何配置可以添加以啓用兩個屬性(域和hasMany)的驗證。
的Grails版本:3.1.14
Example:
class Person {
String name;
static hasMany = [location: Location]
static constraints = {
name nullable: true
}
}
class Location {
String address
String city
State state
String zip
static constraints = {
address nullable: true
}
}
什麼版本的Grails您使用的是?將這個包含在你的問題中會很有幫助。 –
grails 3.1.14 帖子也被編輯 –
https://schneide.wordpress.com/2010/09/20/gorm-gotchas-validation-and-hasmany/你需要類似這樣的信息 – Vahid