1
當添加一本書,你可以這樣做:的Grails 3.1 - 多次插入到域
String author = 'John Smith'
String title = 'First Book'
def book = new Book(author: author, title: title)
book.save(flush: flush, insert: true)
說我想一次添加了一些書,例如,如果輸入的是:
String author = 'John Smith'
String title = ['First Book', 'Second Book', 'Third Book']
如何通過一次調用數據庫來保存所有書籍?
不要使用'沖水:TRUE'讓Grails的給他們一次全部 – doelleri