HHH-16126 TransientObjectException when loading versioned entity from second-level cache
This commit is contained in:
parent
540c9f8e28
commit
27cab33cc5
|
@ -96,6 +96,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
||||||
// per-row state
|
// per-row state
|
||||||
private EntityPersister concreteDescriptor;
|
private EntityPersister concreteDescriptor;
|
||||||
private EntityKey entityKey;
|
private EntityKey entityKey;
|
||||||
|
private Object version;
|
||||||
private Object entityInstance;
|
private Object entityInstance;
|
||||||
private Object entityInstanceForNotify;
|
private Object entityInstanceForNotify;
|
||||||
protected boolean missing;
|
protected boolean missing;
|
||||||
|
@ -827,7 +828,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
||||||
// Also register possible unique key entries
|
// Also register possible unique key entries
|
||||||
registerPossibleUniqueKeyEntries( toInitialize, session );
|
registerPossibleUniqueKeyEntries( toInitialize, session );
|
||||||
|
|
||||||
final Object version = versionAssembler != null ? versionAssembler.assemble( rowProcessingState ) : null;
|
version = versionAssembler != null ? versionAssembler.assemble( rowProcessingState ) : null;
|
||||||
final Object rowId = rowIdAssembler != null ? rowIdAssembler.assemble( rowProcessingState ) : null;
|
final Object rowId = rowIdAssembler != null ? rowIdAssembler.assemble( rowProcessingState ) : null;
|
||||||
|
|
||||||
// from the perspective of Hibernate, an entity is read locked as soon as it is read
|
// from the perspective of Hibernate, an entity is read locked as soon as it is read
|
||||||
|
@ -847,8 +848,6 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
updateCaches( toInitialize, rowProcessingState, session, persistenceContext, entityIdentifier, version );
|
|
||||||
|
|
||||||
registerNaturalIdResolution( persistenceContext, entityIdentifier );
|
registerNaturalIdResolution( persistenceContext, entityIdentifier );
|
||||||
|
|
||||||
takeSnapshot( rowProcessingState, session, persistenceContext, entityEntry );
|
takeSnapshot( rowProcessingState, session, persistenceContext, entityEntry );
|
||||||
|
@ -1141,10 +1140,23 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishUpRow(RowProcessingState rowProcessingState) {
|
public void finishUpRow(RowProcessingState rowProcessingState) {
|
||||||
|
final SharedSessionContractImplementor session = rowProcessingState.getSession();
|
||||||
|
if ( resolvedEntityState != null ) {
|
||||||
|
updateCaches(
|
||||||
|
entityInstanceForNotify,
|
||||||
|
rowProcessingState,
|
||||||
|
session,
|
||||||
|
session.getPersistenceContext(),
|
||||||
|
entityKey.getIdentifier(),
|
||||||
|
version
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// reset row state
|
// reset row state
|
||||||
isOwningInitializer = false;
|
isOwningInitializer = false;
|
||||||
concreteDescriptor = null;
|
concreteDescriptor = null;
|
||||||
entityKey = null;
|
entityKey = null;
|
||||||
|
version = null;
|
||||||
entityInstance = null;
|
entityInstance = null;
|
||||||
entityInstanceForNotify = null;
|
entityInstanceForNotify = null;
|
||||||
missing = false;
|
missing = false;
|
||||||
|
|
Loading…
Reference in New Issue