HHH-13147 - Fix DelayedPostIdentifierInsert when second-level cache enabled.

This commit is contained in:
Chris Cranford 2018-12-07 09:53:58 -05:00
parent 6d5dd25e7a
commit 9ff14a33c7
1 changed files with 6 additions and 0 deletions

View File

@ -4164,6 +4164,12 @@ public abstract class AbstractEntityPersister
canIdentityInsertBeDelayed = true;
if ( getEntityMetamodel().getIdentifierProperty().isIdentifierAssignedByInsert() ) {
// if the persister writes the entity to the second-level cache; we cannot delay.
if ( canWriteToCache ) {
canIdentityInsertBeDelayed = false;
return;
}
// if the persister's identifier is assigned by insert, we need to see if we must force non-delay mode.
for ( NonIdentifierAttribute attribute : getEntityMetamodel().getProperties() ) {
if ( isTypeSelfReferencing( attribute.getType() ) ) {