HHH-8573: Persister is taken according to the actual type of the replaced object

This commit is contained in:
Vasily Kochnev 2013-09-29 22:40:20 +06:00 committed by Brett Meyer
parent 1cc69b382c
commit c926fdba03
1 changed files with 1 additions and 2 deletions

View File

@ -338,9 +338,8 @@ public abstract class EntityType extends AbstractType implements AssociationType
}
if ( session.getContextEntityIdentifier( original ) == null &&
ForeignKeys.isTransient( associatedEntityName, original, Boolean.FALSE, session ) ) {
final Object copy = session.getFactory().getEntityPersister( associatedEntityName )
final Object copy = session.getEntityPersister( associatedEntityName, original )
.instantiate( null, session );
//TODO: should this be Session.instantiate(Persister, ...)?
copyCache.put( original, copy );
return copy;
}