From c926fdba033581a64f7022aaf0cdb2a229b16e6d Mon Sep 17 00:00:00 2001 From: Vasily Kochnev Date: Sun, 29 Sep 2013 22:40:20 +0600 Subject: [PATCH] HHH-8573: Persister is taken according to the actual type of the replaced object --- .../src/main/java/org/hibernate/type/EntityType.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/type/EntityType.java b/hibernate-core/src/main/java/org/hibernate/type/EntityType.java index 6f873d2cfb..68bee2f524 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/EntityType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/EntityType.java @@ -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; }