Hi,
I noticed a kind of inconvenient/inconsistent behaviour when using {{CustomEntityDirtinessStrategy}}:
For checking whether an entity in general is dirty, a call to {{canDirtyCheck}} is made (which is fine):
5.6 / 6.1: [https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java#L382|https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java#L382|smart-link] // [https://github.com/hibernate/hibernate-orm/blob/6.1/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java#L359|https://github.com/hibernate/hibernate-orm/blob/6.1/hibernate-core/src/main/java/org/hibernate/engine/internal/AbstractEntityEntry.java#L359|smart-link]
But then when searching for dirty attributes, the same check is not made anymore to the {{CustomEntityDirtinessStrategy}} therefore calling {{findDirty}}, even if the strategy is not capable of defining if the entity (and in my opinion implicitly its attributes) are dirty
5.6 // 6.1: [https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java#L558|https://github.com/hibernate/hibernate-orm/blob/5.6/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java#L558|smart-link] // [https://github.com/hibernate/hibernate-orm/blob/6.1/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java#L527|https://github.com/hibernate/hibernate-orm/blob/6.1/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java#L527|smart-link]
This is not documented (at least I didn’t find any hint mentioning this behaviour) and actually not expected in my opinion… |
|