HHH-14776 Promote method instantiate(EntityPersister, Serializable) from SessionImplementor to SharedSessionContractImplementor

This commit is contained in:
Sanne Grinovero 2021-08-09 11:45:40 +01:00 committed by Sanne Grinovero
parent 9a335c1c04
commit edcce3e1c2
3 changed files with 13 additions and 3 deletions

View File

@ -78,8 +78,6 @@ public interface SessionImplementor
ActionQueue getActionQueue();
Object instantiate(EntityPersister persister, Serializable id) throws HibernateException;
void forceFlush(EntityEntry e) throws HibernateException;
@Override

View File

@ -333,6 +333,13 @@ public interface SharedSessionContractImplementor
*/
Object instantiate(String entityName, Serializable id) throws HibernateException;
/**
* Instantiate the entity class of an EntityPersister, initializing with the given identifier.
* This is more efficient than {@link #instantiate(String, Serializable)} but not always
* interchangeable: a single persister might be responsible for multiple types.
*/
Object instantiate(EntityPersister persister, Serializable id) throws HibernateException;
/**
* Execute an SQL Query
*/

View File

@ -275,8 +275,13 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
public Object instantiate(
String entityName,
Serializable id) throws HibernateException {
return instantiate( getFactory().getMetamodel().entityPersister( entityName ), id );
}
@Override
public Object instantiate(EntityPersister persister, Serializable id) throws HibernateException {
checkOpen();
return getFactory().getMetamodel().entityPersister( entityName ).instantiate( id, this );
return persister.instantiate( id, this );
}
@Override