quarkus: Hibernate ORM and Hibernate Reactive cannot be used in the same application

Describe the bug when i boot both hibernate-reactive and hibernate-orm in my own project it throw an IllegalStateException and Quarkus startup failure

My application.yaml:

quarkus:
  datasource:
    jdbc:
      url: ${JDBC_DATABASE_URL:jdbc:mysql://mysql:3306/temple}
    reactive:
      url: ${DATABASE_URL:mysql://mysql:3306/temple}

I think it’s probably because a private method checkIsReactive in PreconfiguredReactiveServiceRegistryBuilder.class . This inspection is not supposed to be here. It should be put in FastBootHibernateReactivePersistenceProvider.getEntityManagerFactoryBuilderOrNull where the RecordedState be created at.

           RecordedState recordedState = PersistenceUnitsHolder.getRecordedState(persistenceUnitName);
           if(!recordedState.isReactive()){
                log.debug("An Hibernate Reactive serviceregistry can't boot on a non-reactive RecordedState!");
                continue;
           }


            final PrevalidatedQuarkusMetadata metadata = recordedState.getMetadata();
            final BuildTimeSettings buildTimeSettings = recordedState.getBuildTimeSettings();
            final IntegrationSettings integrationSettings = recordedState.getIntegrationSettings();
            RuntimeSettings.Builder runtimeSettingsBuilder = new RuntimeSettings.Builder(buildTimeSettings,
                    integrationSettings);

This is more in keeping with the original purpose of the method getEntityManagerFactoryBuilderOrNull

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 37 (13 by maintainers)

Most upvoted comments

Should we be expecting at some point down the road, to be able to successfully mix reactive and jdbc datasources?

Eventually yes of course. In this area unfortunately changes need to be done in this order:

  • move Quarkus to Jakarta EE (lots of work!), so that we can use Hibernate ORM 6
  • Upgrade to Hibernate ORM 6 (lots of work!)
  • Rewrite Hibernate Reactive to be based on Hibernate ORM 6 (…!)
  • Rewrite the Hibernate Reactive / Quarkus extension as 90% of it will need to be different

For these reasons I’m not working on the current Hibernate Reactive extension. N.B. the above tasks are big but they are mostly complete now, except the last one - so I don’t expect this will take ages yet.

Any work on this?

@yesvike yes…see 2nd comment above. For your case, that other bug is blocking your usage of db2-reactive so you’ll need another service…

If you could share a reproducer I’d like to have a look. To be clear, mixing is still not expected to work, but it looks like we should at very least improve the error messages or the diagnosticts to figure out what’s happening in this case.