-
-
Notifications
You must be signed in to change notification settings - Fork 260
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 immediately dirty on load if multiple enum as property #3129
Comments
We did further analysis on this problem and we figure out the exact cause of this wrong dirtiness detection. The problem come from PostgreSQL not respecting order of fields while using JSONB column type because the data is stored optimized. It seems that PostgreSQL is storing the keys as following :
In class This dirtiness will never be resolved and these bean will always be considered dirty on load because when Ebean will persist the new value (with its own ordering) in the database, PostgreSQL will reorder the fields to optimize the way it is stored. We successfully avoid these wrong dirtiness status adding We were wondering if it could be interesting to modify the method Maybe you will have an idea @rbygrave or @rPraml ? Thanks in advance for your help. |
…ld ordering on both sides (due to PostgreSQL reordering fields for JsonB types)
Fix to verify DBJson dirtiness using same field ordering on both sides (due to PostgreSQL reordering fields for JsonB types)
Hi everyone,
We are having a strange behavior with
DbJsonB
feature on POJO where multiple properties are Enum.Ebean Version : 13.20.1
Expected behavior
Having an entity
A
with aDbJsonB
property composed of a POJOB
with multiple fields (each fields is an enum).After DB/find.byId of entity
A
,DB.beanState
should answer that the entity is not dirty.Actual behavior
Having an entity
A
with aDbJsonB
property composed of a POJOB
with multiple fields (each fields is an enum).After DB/find.byId of entity
A
,DB.beanState
answer that the entity is dirty on theDbJsonB
property even without change.Steps to reproduce
Here is the value for this property in database :
When executing :
DB.beanState(A.find.byId(1L)).dirtyValues()
If mutationDetection = SOURCE :
=> Return the property
sources
withOld
beingnull
andNew
being the value from database.If mutationDetection = DEFAULT :
=> Return the property
sources
withOld
andNew
value being the same (value from database) but with different object reference.Important note :
DataProviderEnum
byString
type, the problem disappearThanks in advance for your help.
Yours faithfully,
LCDP
The text was updated successfully, but these errors were encountered: