Merge remote-tracking branch 'upstream/main' into wip/6.0

This commit is contained in:
Andrea Boriero 2021-08-16 16:21:26 +02:00
commit ffff90757a
1 changed files with 5 additions and 8 deletions

View File

@ -153,12 +153,12 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
@Override
public Object get(Class entityClass, Object id) {
return get( entityClass.getName(), id, LockMode.NONE );
return get( entityClass.getName(), id );
}
@Override
public Object get(Class entityClass, Object id, LockMode lockMode) {
return get( getFactory().getMetamodel().entityPersister( entityClass ), id, lockMode );
return get( entityClass.getName(), id, lockMode );
}
@Override
@ -168,13 +168,10 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
@Override
public Object get(String entityName, Object id, LockMode lockMode) {
return get( getFactory().getMetamodel().entityPersister( entityName ), id, lockMode );
}
protected Object get(final EntityPersister ep, final Object id, final LockMode lockMode) {
checkOpen();
Object result = ep.load( id, null, getNullSafeLockMode( lockMode ), this );
Object result = getFactory().getMetamodel().entityPersister( entityName )
.load( id, null, getNullSafeLockMode( lockMode ), this );
if ( temporaryPersistenceContext.isLoadFinished() ) {
temporaryPersistenceContext.clear();
}
@ -468,7 +465,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
throws HibernateException {
checkOpen();
if ( entityName == null ) {
return getFactory().getMetamodel().entityPersister( object.getClass() );
return getFactory().getMetamodel().entityPersister( guessEntityName( object ) );
}
else {
return getFactory().getMetamodel().entityPersister( entityName ).getSubclassEntityPersister( object, getFactory() );