-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't unset value on embedded object #718
Comments
Try |
no luck I'm afraid. In my real world app the save includes changes to other properties in the embedded object, which all work fine. It's just the null value seems to be ignored |
Hello, Just trying to test this update with the 5.0.8 release. It seems to be fixed in grails 2.5.4, but not grails 3.1.x? Thanks |
Should be fixed in both, other please upload a 3.1.x app somewhere that reproduces the problem |
https://github.com/paulfairless/myapp Tried both 6.0.0.M1 and 5.0.8 |
Thanks will take a look next week, underlying issue is probably the property not being marked as dirty since nulls weren't taken into account before. Calling |
Thanks Graeme, appreciated. Not having any luck with markDirty. Given it's working with the same sample app in 2.5.4 is it possible that the changes didn't get released via the 3.1.x build process correctly? |
looks like this works in grails 3.1.8 but didn't in 3.1.6 |
Probably for 3.1.6 you didn't have the correct libraries on your path. See http://grails.io/post/143431711043/how-to-use-a-specific-version-of-gorm-in-grails-3 for how to use a specific version of GORM |
yes - I expect that was my issue. Many thanks |
Can someone please tell how to fix this issue? I have an embedded object in my domain class which once set, doesn't get unset. I used Grails 3.1.6 as well as 3.1.8 along with various versions of GORM including 5.0.6.RELEASE and upwards till 5.0.12.RELEASE. |
Can someone please comment on how to fix this issue? I am still not able to figure out how to fix this issue |
I created another issue grails/grails-data-mongodb#152 |
I am also facing this issue Configurations: I want unset the value of a string field domainInstance.token = null
// domainInstance.token.putAt("token", null)
domainInstance.markDirty("token")
domainInstance.save(flush: true, failOnError: true) I have made the static constraints = {
token nullable:true
} Although when I try this will non-null value, it is getting updated. |
Can we reopen this issue, please |
Having the same issue. Grails: 4.0.1 Setting a List<> to null on one of the domain objects, the property was not being removed from the persisted object. The other non-list changes were being persisted. I was able to remove it with the a Domain.collection.updateOne call, but I ran into issues with being able to rollback the changes inside a transaction when intermixing updates like that with normal Gorm updates. One thing that does seem to work for me is to call |
Any update here? |
Encountered an issue while upgrading a grails 2.5.4 app to Gorm 5
mongodb:5.0.6.RELEASE
, whereby I can no longer unset a values from within an embedded object list. It seems null values are ignored as setting to a different value works as expected:Owner.groovy
Pet.groovy
Bootstrap.groovy
The text was updated successfully, but these errors were encountered: