From 6409db767d40fe685b54768553feedcad8351b07 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 19 May 2022 18:01:14 +0200 Subject: [PATCH] HHH-15286 Query with a Composite Identifier (@IdClass) throws an exception --- .../org/hibernate/event/internal/DefaultLoadEventListener.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java index cf84d4eed9..1bc67a7973 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java @@ -153,6 +153,9 @@ public class DefaultLoadEventListener implements LoadEventListener { return; } } + else if ( idClass.isInstance( event.getEntityId() ) ) { + return; + } } else if ( idMapping instanceof NonAggregatedIdentifierMapping ) { if ( idClass.isInstance( event.getEntityId() ) ) {