Grails:.save(flush:flush,insert:true)与.save(flush:true) [英] Grails: what does .save(flush:flush, insert:true) do differently from .save(flush:true)
问题描述
UserRole
或 SecUserSecRole
(你可以称之为任何你选择的),有一个命令创建一个新的UserRole()
并保存为 .save(flush:flush,insert:true)
这是什么意思?它与.save(flush:true)有什么不同?
从 Grails文档:
insert(可选) - 设置为true时,将强制Hibernate执行SQL
INSERT,这在涉及传统数据库
(如AS / 400)的某些情况下很有用, Hibernate无法检测到
是否执行INSERT或UPDATE
In the spring security generated class UserRole
or SecUserSecRole
(you could call it whatever you choose) there is a command to make a new UserRole()
and save it with .save(flush:flush, insert:true)
What does that mean? What is it doing differently from .save(flush:true)?
From the Grails docs:
insert (optional) - When set to true will force Hibernate to do a SQL INSERT, this is useful in certain situations when legacy databases (such as AS/400) are involved and Hibernate cannot detect whether to do an INSERT or an UPDATE
这篇关于Grails:.save(flush:flush,insert:true)与.save(flush:true)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!