【发布时间】:2019-09-20 19:24:09
【问题描述】:
Grails 3.2.9 版
Grails documentation for withTransaction 并没有说明使用 Author.withTransaction 和 Book.withTransaction 之间的区别,以防我想同时保存 Author 和 Book 域实例交易如下:
Author author = Author.get(1)
Book book = Book.findByAuthor(author)
Author.withTransaction { // what if we use Book here instead of Author
author.age = 39
book.price = 45
author.save(failOnError: true)
book.save(failOnError: true)
}
没有找到任何其他说明差异的文档。
【问题讨论】:
标签: hibernate grails grails-orm