假设我有这个代码
领域
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()
应该为每个子实例添加锁还是在获取父实例时添加它?