2
Grails GORM withTransaction
とgroovy.sql.Sql
は、ストアドプロシージャのSQL呼び出しをwithTransaction
の内部に置くと同じ接続を使用しますか?たとえば:Grails:groovy.sql.SqlとModel.withTransaction何が起こるのですか?
@Validateable
class MyCommand {
List<MyModel> listOfModel
}
、その後、私は、このコマンド
class MyService {
def dataSource
def handleCommand(MyCommand command) {
MyModel.withTransaction { status ->
for(MyModel m : command.listOfModel) {
if(!m.save()) {
status.setRollbackOnly()
throw new MyException(m.errors)
}
}
//now I need to call a stored proc. This will use the same connection?
//withTransaction will commit the call?
Sql s = new Sql(dataSource)
s.call('my_stored_proc')
}
}
}