Precondition: We have an entity class annotated with NaturalIdCache and the choosen strategy is CacheConcurrencyStrategy.READ_WRITE. When persisting & deleting such an entity object within the same transaction, after the commit we remain with an obsolete cache entry (key=<naturalid-value> value=<primary key>) If we now create another persistent object with the same naturalId value, this cannot be resolved anymore from shared cache anymore because the cache entry points to an obsolete (deleted) primary key.
For more informations please see upcoming Pullrequest which will contain a testcase and a fix proposal. |