Grails:.save(flush:flush,insert:true)与.save(flush:true) [英] Grails: what does .save(flush:flush, insert:true) do differently from .save(flush:true)

查看:446
本文介绍了Grails:.save(flush:flush,insert:true)与.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆