Skip to content

Commit

Permalink
Hibernate Reactive: fail the build unless exactly one PU configured
Browse files Browse the repository at this point in the history
  • Loading branch information
mkouba committed Feb 26, 2024
1 parent 94c41be commit f3ff2c7
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,16 @@ void registerBeans(BuildProducer<AdditionalBeanBuildItem> additionalBeans, Combi
// Only register the bean if their EMF dependency is also available, so use the same guard as the ORM extension
additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveSessionFactoryProducer.class));
} else {
LOG.warnf(
"Skipping registration of %s bean because exactly one persistence unit is required for their registration",
ReactiveSessionFactoryProducer.class.getSimpleName());
if (hasEntities(jpaModel)) {
throw new ConfigurationException(
"The Hibernate Reactive extension requires exactly one persistence unit configured: " + descriptors
.stream()
.map(PersistenceUnitDescriptorBuildItem::getPersistenceUnitName).collect(Collectors.toList()));
} else {
LOG.warnf(
"Skipping registration of %s bean because exactly one persistence unit is required for their registration",
ReactiveSessionFactoryProducer.class.getSimpleName());
}
}
}

Expand Down

0 comments on commit f3ff2c7

Please sign in to comment.