diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java index 1e4c60e923ff31..5a368bb193981b 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java @@ -83,6 +83,10 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.tuple.UpdateTimestampGeneration"), createConstant("org.hibernate.tuple.VmValueGeneration")); + public static final List EXTRA_EVENT_LISTENERS = List.of( + createConstant("org.hibernate.event.spi.PreUpsertEventListener"), + createConstant("org.hibernate.event.spi.PostUpsertEventListener")); + public static final List PACKAGE_ANNOTATIONS = List.of( createConstant("org.hibernate.annotations.CollectionTypeRegistration"), createConstant("org.hibernate.annotations.CompositeTypeRegistration"), diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/GraalVMFeatures.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/GraalVMFeatures.java index 59ccbbc5a94ed6..c94691ddd09e9d 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/GraalVMFeatures.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/GraalVMFeatures.java @@ -1,5 +1,6 @@ package io.quarkus.hibernate.orm.deployment; +import static io.quarkus.hibernate.orm.deployment.ClassNames.EXTRA_EVENT_LISTENERS; import static io.quarkus.hibernate.orm.deployment.ClassNames.GENERATORS; import org.jboss.jandex.DotName; @@ -21,6 +22,14 @@ NativeImageFeatureBuildItem staticNativeImageFeature() { return new NativeImageFeatureBuildItem("org.hibernate.graalvm.internal.GraalVMStaticFeature"); } + // Workaround for https://hibernate.atlassian.net/browse/HHH-18284 + @BuildStep + ReflectiveClassBuildItem registerMissingListenerClassesForReflections() { + return ReflectiveClassBuildItem + .builder(EXTRA_EVENT_LISTENERS.stream().map(d -> d.toString() + "[]").toArray(String[]::new)) + .build(); + } + // Workaround for https://hibernate.atlassian.net/browse/HHH-16439 @BuildStep ReflectiveClassBuildItem registerGeneratorClassesForReflections() {