HHH-14776 Optimise Loader operations by using the Persister directly

This commit is contained in:
Sanne Grinovero 2021-08-09 14:23:04 +01:00 committed by Sanne Grinovero
parent edcce3e1c2
commit 135361a6b8
1 changed files with 8 additions and 1 deletions

View File

@ -1765,7 +1765,14 @@ public abstract class Loader {
}
else {
// instantiate a new instance
object = session.instantiate( instanceClass, key.getIdentifier() );
if ( persister.hasSubclasses() ) {
object = session.instantiate( instanceClass , key.getIdentifier() );
}
else {
//When there are no subclasses, use the persister instance directly
//so to short-circuit the persister lookup:
object = session.instantiate( persister, key.getIdentifier() );
}
}
//need to hydrate it.