我有Machine and Parts域类
在我的服务类中,我试图启动一个事务,在该事务内,我想创建一个新事务,并在内部事务中将其提交。
Machine.withTransaction { // transaction 1
// some code to add Parts
// some code to remove Parts
Machine.withNewTrasaction { // transaction 2
// some code to remove Parts.
} // end of transaction 2
// some code to update couple of columns in machine table.
}// end of transaction 1
Run Code Online (Sandbox Code Playgroud)
当它出来时,transaction 2我想transaction 2提交与机器无关的零件transaction 1。但是grails抛出了一个错误,如"Illegal attempt to associate a collection with two open sessions"
如何transaction 2单独提交单独而不考虑transaction 1 …