From 44f39dc77435886a237d8ac2b899ce0d3e2c18e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Fri, 20 Dec 2024 15:59:04 +0100 Subject: [PATCH] Register IdClass for reflection when defined through orm.xml --- .../orm/deployment/JpaJandexScavenger.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/JpaJandexScavenger.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/JpaJandexScavenger.java index daa8d4ddb6a11..5ed90bbe87bcc 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/JpaJandexScavenger.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/JpaJandexScavenger.java @@ -215,6 +215,11 @@ private void enlistOrmXmlMappingManagedClass(Collector collector, String package collector.entityTypes.add(name); } + var idClass = managed.getIdClass(); + if (idClass != null) { + enlistIdClass(collector, DotName.createSimple(qualifyIfNecessary(packagePrefix, idClass.getClazz()))); + } + enlistOrmXmlMappingListeners(collector, packagePrefix, managed.getEntityListenerContainer()); } @@ -405,12 +410,16 @@ private void enlistJPAModelIdClasses(Collector collector, DotName dotName) { } for (AnnotationInstance annotation : jpaAnnotations) { - DotName targetDotName = annotation.value().asClass().name(); - addClassHierarchyToReflectiveList(collector, targetDotName); - collector.modelTypes.add(targetDotName.toString()); + DotName valueDotName = annotation.value().asClass().name(); + enlistIdClass(collector, valueDotName); } } + private void enlistIdClass(Collector collector, DotName idClass) { + addClassHierarchyToReflectiveList(collector, idClass); + collector.modelTypes.add(idClass.toString()); + } + private void enlistPotentialCdiBeanClasses(Collector collector, DotName dotName) { Collection jpaAnnotations = index.getAnnotations(dotName);