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
Hibernate can attempt to write unloaded proxy state to the database in some circumstances, effectively 'nulling out' a row. This can happen in transactions that are otherwise read only.
Initialize a collection field with an empty collection
And have a date field (or other mutable property)
Create a proxy for the entity but don't actually load it
Hibernate will get confused, and will write out the unitialized state.
I am not 100% sure how this is supposed to work, but it seems like SimpleCollectionTracker is not initialized with the names and sizes, which makes it return -1 which triggers a full dirty check. As the proxy is not loaded in the mutable property check in org.hibernate.persister.entity.AbstractEntityPersister#resolveDirtyAttributeIndexes will think the date has been modified as previousState == null. This causes hibernate to write out empty data into the DB.
The text was updated successfully, but these errors were encountered:
Hibernate can attempt to write unloaded proxy state to the database in some circumstances, effectively 'nulling out' a row. This can happen in transactions that are otherwise read only.
Reproducer is here:
master...stuartwdouglas:hibernate-data-loss
Basically if you:
Hibernate will get confused, and will write out the unitialized state.
I am not 100% sure how this is supposed to work, but it seems like SimpleCollectionTracker is not initialized with the names and sizes, which makes it return -1 which triggers a full dirty check. As the proxy is not loaded in the mutable property check in org.hibernate.persister.entity.AbstractEntityPersister#resolveDirtyAttributeIndexes will think the date has been modified as previousState == null. This causes hibernate to write out empty data into the DB.
The text was updated successfully, but these errors were encountered: