The Grails Framework - Groovy reference documentation
author:book = 1:多, book添加约束:title blank:false
def b = new org.bookstore.Book()
b.validate()
if (b.hasErrors()) {
println 'hasErrors'
b.clearErrors()
b.title = 'xx'
b.author = new org.bookstore.Author(name:'xxx') //这一句不可以缺少
b.validate()
if (b.hasErrors()) {
b.clearErrors()
println 'still hasErrors'
}else {
println 'over'
}
}