You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to manage updates to a domain object through different controller actions with the object stored in the session. At the end of the editing I'm doing a merge to push the changed fields of the object to the datastore. The merge completes without error but the changes are not sent to the database.
The only workaround I've found for this is to call markDirty() on the object returned from the merge method:
...
log.debug "doing merge..."
def mergeRet = data.merge(failOnError: true, flush: true)
log.debug "merge return data: $data"
mergeRet.markDirty() // todo: this forces the save of the merged entity - otherwise the changes do not get pushed out to the DB
...
The object then gets saved after the method exits and the transaction gets flushed / committed. Probably quicker not to pass in flush: true to the merge when doing it this way.
Please push the code to a separate GitHub repo. I am a little confused as to what you are trying to do. One suggestion, I have is to move the code related to GORM operations into a separate service.
I'm trying to manage updates to a domain object through different controller actions with the object stored in the session. At the end of the editing I'm doing a merge to push the changed fields of the object to the datastore. The merge completes without error but the changes are not sent to the database.
I've reproduced with a simple project -
grailsMergeBug-bug-report-01112022.zip. Go to http://localhost:8080/data to reproduce.
The domain object looks like this:
Changes to the
name
ornumber
fields do not get merge saved.I've simulated the editing, storing in session and merge in a controller:
Going to checkSaved action in a browser shows that the object has not been updated.
Versions:
The text was updated successfully, but these errors were encountered: