Skip to content

Commit

Permalink
Do not assume a blockng pu is needed, if it's reactive but we don't h…
Browse files Browse the repository at this point in the history
…ave a JDBC data source we don't generate the blocking pU
  • Loading branch information
lucamolteni committed Nov 14, 2024
1 parent 87229ff commit db5dbb5
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,18 @@ public void parsePersistenceXmlDescriptors(HibernateOrmConfig config,
public ImpliedBlockingPersistenceUnitTypeBuildItem defineTypeOfImpliedPU(
List<JdbcDataSourceBuildItem> jdbcDataSourcesBuildItem, //This is from Agroal SPI: safe to use even for Hibernate Reactive
Capabilities capabilities) {
return ImpliedBlockingPersistenceUnitTypeBuildItem.generateImpliedPersistenceUnit();
if (capabilities.isPresent(Capability.HIBERNATE_REACTIVE) && jdbcDataSourcesBuildItem.isEmpty()) {
// if we don't have any blocking datasources and Hibernate Reactive is present,
// we don't want a blocking persistence unit
return ImpliedBlockingPersistenceUnitTypeBuildItem.none();
} else if (capabilities.isPresent(Capability.HIBERNATE_REACTIVE)) {
// We have reactive, but we have also defined a blocking datasource
return ImpliedBlockingPersistenceUnitTypeBuildItem.generateImpliedPersistenceUnit();
} else {
// even if we don't have any JDBC datasource, we trigger the implied blocking persistence unit
// to properly trigger error conditions and error messages to guide the user
return ImpliedBlockingPersistenceUnitTypeBuildItem.generateImpliedPersistenceUnit();
}
}

@BuildStep
Expand Down

0 comments on commit db5dbb5

Please sign in to comment.