-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
@DbJsonB Map Still Perform ModifyAware Dirty Checking When MutationCheck is NONE #2840
Comments
A little debugging showed that in ebean/ebean-core/src/main/java/io/ebeaninternal/server/type/DefaultTypeManager.java Lines 345 to 351 in 7affd20
Since |
Yes.
Well I can explain the background as to why it is like that and then we can see what we think from there. The
The Map implementation returned for this case is going to be a So internally the EXCEPT ... if we want I think it is fair to say this is a case we didn't consider / missed and we should treat this as a bug. I think the next step is to consider if we fix this / treat it as a bug without resorting to a workaround. The potential workaround being that if the field has a Jackson annotation it then skips that and gets handled via ObjectMapper etc [but this isn't ideal, I don't like this workaround as we don't want to rely on that / bit of a hack etc ... but maybe ok for short term workaround]. Edit: Note there are 2 PRs around refactoring out modules for ebean-jackson-jsonnode and ebean-jackson-mapper so I'll almost certainly desire to pull those in first. |
Thanks for the explanation, @rbygrave. That makes a lot of sense. While looking into this, I found that there are a lot of inconsistency between how a A few other things I found:
I think it would be a great improvement to make these cases work consistently. If you decided that the current behaviour is what it should be or it can't be fixed in the short term, it would still be great to clarify this in the documentation at https://github.com/ebean-orm/ebean-annotation/blob/master/src/main/java/io/ebean/annotation/MutationDetection.java. While the Thank you for taking the time to look into this issue. |
Expected behavior
A
Map<String, Object>
field only annotated with@DbJsonB(mutationCheck = MutationCheck.NONE)
in an@Entity
bean should not invoke modify aware dirty checking logic when saved. This correct behaviour can be observed if the annotated field is typedObject
.Actual behavior
Modify aware logic is always on regardless of
MutationCheck.NONE
being set as the json mutation check strategy on@DbJsonB
annotation or as the server default onDatabaseConfig
.Steps to reproduce
The code below can be found in sample project test-ebean.
Log:
Expected transaction
1003
and1004
to behave the same, i.e. not perform update.However, transaction
1003
actually performs an update (see log at 11:17:02.195).The text was updated successfully, but these errors were encountered: