Guenther Demetz (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYmNiZTEzNGEz...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16557?atlOrigin=eyJpIjoiYmNiZT...
) HHH-16557 (
https://hibernate.atlassian.net/browse/HHH-16557?atlOrigin=eyJpIjoiYmNiZT...
) NaturalIdCache remains with wrong key-value after create-delete-recreate action (
https://hibernate.atlassian.net/browse/HHH-16557?atlOrigin=eyJpIjoiYmNiZT...
)
Change By: Guenther Demetz (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
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.
{noformat} scope.inTransaction(
(session) -> {
AllCached it = new AllCached( "it" );
session.persist(it);
session.remove(it);
}
);
// now recreate with same naturarId naturalId value
scope.inTransaction(
(session) -> {
AllCached it = new AllCached( "it" );
session.persist(it);
}
);
scope.inTransaction(
(session) -> {
final AllCached shouldBeThere = session.bySimpleNaturalId( AllCached.class ).load(
"it" );
assertNotNull( shouldBeThere ); // FAILS!!!!
}
);
{noformat}
For more informations please see upcoming Pullrequest which will contain a testcase and a
fix proposal.
(
https://hibernate.atlassian.net/browse/HHH-16557#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16557#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:f83bc8f )