From 1d4d018dfa0c7bb06d27cc03f291feab7ef732fd Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Fri, 9 Aug 2019 15:52:54 +0100 Subject: [PATCH] HHH-13552 Avoid retrieving the same Persister twice --- .../src/main/java/org/hibernate/type/CollectionType.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java index 9ff331fa9b..cf523ed326 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java @@ -462,8 +462,9 @@ public abstract class CollectionType extends AbstractType implements Association ownerId = key; } else { - Type keyType = getPersister( session ).getKeyType(); - EntityPersister ownerPersister = getPersister( session ).getOwnerEntityPersister(); + final CollectionPersister persister = getPersister( session ); + Type keyType = persister.getKeyType(); + EntityPersister ownerPersister = persister.getOwnerEntityPersister(); // TODO: Fix this so it will work for non-POJO entity mode Class ownerMappedClass = ownerPersister.getMappedClass(); if ( ownerMappedClass.isAssignableFrom( keyType.getReturnedClass() ) &&