假设我有这段代码
域
class Parent{
static hasMany = [Childs:Child]
}
class Child {
String name
}
控制器
def ParentInstance = Parent.get(1) //Parent.lock(1)
ParentInstance.Childs.each {
//it.lock()
it.name = "titi"
}
ParentInstance.save()
应该为每个子实例添加锁定,还是仅在获取父实例时添加锁定?