Hibernate data loss bug: Hibernate can null out a row in some circumstances #14881
Labels
area/hibernate-orm
Hibernate ORM
area/persistence
OBSOLETE, DO NOT USE
kind/bug
Something isn't working
Milestone
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: