From 834a4cb62682efe46581b8861dc26535432779fe Mon Sep 17 00:00:00 2001 From: Gwenneg Lepage Date: Wed, 15 Sep 2021 22:25:17 +0200 Subject: [PATCH] Log when reactive session producers registration is skipped --- .../orm/deployment/HibernateOrmProcessor.java | 1 + .../deployment/HibernateReactiveProcessor.java | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java index b51cb54fb6641..053d1ed3af1a9 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java @@ -323,6 +323,7 @@ public void configurationDescriptorBuilding( if (!hasEntities(jpaModel)) { // we can bail out early as there are no entities + LOG.warn("Hibernate ORM is disabled because no JPA entities were found"); return; } diff --git a/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java b/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java index 4c21777038b78..91098a4b8bb4e 100644 --- a/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java +++ b/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java @@ -24,6 +24,7 @@ import org.hibernate.cfg.AvailableSettings; import org.hibernate.jpa.boot.internal.ParsedPersistenceXmlDescriptor; import org.hibernate.loader.BatchFetchStyle; +import org.jboss.logging.Logger; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.datasource.deployment.spi.DefaultDataSourceDbKindBuildItem; @@ -65,6 +66,7 @@ public final class HibernateReactiveProcessor { private static final String HIBERNATE_REACTIVE = "Hibernate Reactive"; + private static final Logger LOG = Logger.getLogger(HibernateReactiveProcessor.class); static final String[] REFLECTIVE_CONSTRUCTORS_NEEDED = { "org.hibernate.reactive.persister.entity.impl.ReactiveSingleTableEntityPersister", "org.hibernate.reactive.persister.entity.impl.ReactiveJoinedSubclassEntityPersister", @@ -82,14 +84,14 @@ FeatureBuildItem feature() { void registerBeans(BuildProducer additionalBeans, CombinedIndexBuildItem combinedIndex, List descriptors, JpaModelBuildItem jpaModel) { - if (!hasEntities(jpaModel)) { - return; - } - if (descriptors.size() == 1) { // Only register those beans if their EMF dependency is also available, so use the same guard as the ORM extension additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveSessionFactoryProducer.class)); additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveSessionProducer.class)); + } else { + LOG.warnf( + "Skipping registration of %s and %s because exactly one persistence unit is required for their registration", + ReactiveSessionFactoryProducer.class.getSimpleName(), ReactiveSessionProducer.class.getSimpleName()); } } @@ -125,6 +127,7 @@ public void buildReactivePersistenceUnit( final boolean enableHR = hasEntities(jpaModel); if (!enableHR) { // we have to bail out early as we might not have a Vertx pool configuration + LOG.warn("Hibernate Reactive is disabled because no JPA entities were found"); return; }