gorm - Benefits of object.get() vs object.read() in Grails -


I was skimming some of the Grails documentation and found a little about the read () method in Grates . If I understand it correctly, you can drag the "read-only" version of the object from that database which will be saved only on the clear saved () call, I think, That whenever you have an object that you do not expect to change then you should use the read () call.

But why do not you just always use a reading () call? Since if you do not save to save anyway, will it not be safe to read in the object instead of receiving it if the object will be changed to read / write permissions?

You are probably right - this would be equivalent in most cases but there is no need to be in hibernation You call save because it examines dirty during the flush and since Greece uses the "open session in the view" interceptor, then always flush the request at the end of each. It is amazing that those who make changes in an example were received by get () , this meant only to be temporary in the form of the scene, but then without any change, save ( ) Call read () that would be more understandable in that scenario.

A demonstration optimization is to use only for pushing changed fields into the database. There is no need to create new SQL for each update to push all the fields by default whether or not they have changed. If you do not keep the original data in the read () hibernate, then dynamic updates will not be possible because there is no idea which areas are dirty.

Comments