From 86f310e4cb2ab48b4ad9f9d327a172b08b86281f Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Tue, 26 Sep 2017 22:10:48 -0700 Subject: [PATCH] HHH-11970 : @NotFound(IGNORE) and @BatchSize --- .../org/hibernate/engine/internal/BatchFetchQueueHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/BatchFetchQueueHelper.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/BatchFetchQueueHelper.java index c54387a09d..5d04bbaaa9 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/BatchFetchQueueHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/BatchFetchQueueHelper.java @@ -55,8 +55,8 @@ public class BatchFetchQueueHelper { LOG.debug( "Not all entities were loaded." ); Set idSet = new HashSet<>( Arrays.asList( ids ) ); for ( Object result : results ) { - final Serializable id = session.getPersistenceContext().getEntry( result ).getId(); - idSet.remove( id ); + // All results should be in the PersistenceContext + idSet.remove( session.getContextEntityIdentifier( result ) ); } assert idSet.size() == ids.length - results.size(); if ( LOG.isDebugEnabled() ) {