In the spring class with UserRole or SecUserSecRole security protection (you can call it whatever you choose), there is a command to make new UserRole() and save it with .save(flush:flush, insert:true)
UserRole
SecUserSecRole
new UserRole()
.save(flush:flush, insert:true)
What does it mean? What does it do otherwise than .save (flush: true)?
From Grails docs :
Insert (optional) - if set to true, this will force Hibernate to execute SQL INSERT, it is useful in certain situations when outdated databases (for example, AS / 400), and Hibernate cannot determine whether to do INSERT or UPDATE
People usually use flush () because they are not comfortable working with Hibernate.
If you need to know more about this, check this out http://blog.springsource.com/2010/06/23/gorm-gotchas-part-1/
Sometimes you need, in particular, when you are working in the same thread as the save () call, and you need to be sure that the domain object is stored in the database. In addition, some restrictions in your domain use a database to validate data. Sometimes you need to make sure that validation works. Here is an example of this:
http://johnrellis.blogspot.com/2009/09/grails-constraints-across-relationships.html
So, in principle, you should only use flash, if you really need something in the database RIGHT NOW! It is less than you think. I hope this help, and not a single bit of humor in the conversation about painting ... were so proud :)
URL: http://grails.1312388.n4.nabble.com/When-to-use-domain-save-flush-true-or-domain-save-td2289869.html
Source: https://habr.com/ru/post/1396724/More articles:Why is Int32 switching to Float64, which leads to data changes? - .netBlack diamond question marks versus loss of certain characters - htmlIs there a way to send DTMF tones during a conversation using linphone? - iosC # referencing a variable from another method - methodsInsert db strings with Korma - sql.NET 4 SDK Does Not Install Bootstrapper Directory - winapignumake rules and templates - makefilehttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1396727/how-to-allow-a-beta-tester-to-run-my-ipad-application-without-physical-access-to-ipad&usg=ALkJrhhB_YA0B7FrstabQ-A3s_aqSPY-fAoptimal measurement java gui - javaLoading backbone.js into a node js application - node.jsAll Articles