Skip to content

Keep the Hibernate ORM and Reactive extensions enabled even when no entity is defined #48732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yrodiere
Copy link
Member

@yrodiere yrodiere commented Jul 2, 2025

Opening as draft because this is based on #48726, which must be merged first. => Done

This should be neutral for most applications.

It will impact applications that depend on the Hibernate ORM extension without defining any entity (no orm.xml, no hbm.xml, no class annotated with @Entity). These applications will now start Hibernate ORM, whereas they would previously have skipped starting it.

If the extension configuration is valid, this will allow running e.g. native queries using Session or (preferably) StatelessSession.

If the extension configuration is invalid (missing datasource, ...) this might result in errors.

The extension can still be disabled explicitly by setting quarkus.hibernate-orm.enabled=false, which will be approximately the same as not defining any entity before this patch -- except some native image configuration might get skipped.

@quarkus-bot quarkus-bot bot added area/hibernate-orm Hibernate ORM area/hibernate-search Hibernate Search area/hibernate-reactive Hibernate Reactive labels Jul 2, 2025
Copy link

quarkus-bot bot commented Jul 2, 2025

/cc @gsmet (hibernate-orm,hibernate-search), @marko-bekhta (hibernate-search)

@geoand
Copy link
Contributor

geoand commented Jul 3, 2025

Glad to see this!

@maxandersen will also love it too

@yrodiere yrodiere marked this pull request as ready for review July 3, 2025 07:03

This comment has been minimized.

@yrodiere yrodiere added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Jul 3, 2025

This comment has been minimized.

@yrodiere
Copy link
Member Author

yrodiere commented Jul 3, 2025

Some tests are failing because they test something unrelated, but happen to be in that case where they have no entity and the persistence unit is not configured correctly. I'll look into fixing them.

@quarkus-bot quarkus-bot bot added area/flyway area/panache area/spring Issues relating to the Spring integration labels Jul 3, 2025

This comment has been minimized.

Copy link

github-actions bot commented Jul 3, 2025

🎊 PR Preview 45c932f has been successfully built and deployed to https://quarkus-pr-main-48732-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@maxandersen
Copy link
Member

Awesome!

@yrodiere
Copy link
Member Author

yrodiere commented Jul 4, 2025

Some tests are failing because they test something unrelated, but happen to be in that case where they have no entity and the persistence unit is not configured correctly. I'll look into fixing them.

The Maven tests in particular (see previous report) are a bloodbath.

I think I'll try to work on #43594 first
This part in particular would make testing so much easier:

If a datasource used by Hibernate ORM is inactive (explicitly or because its URL is not set), the corresponding SessionFactory/Session beans would be inactive

…eed it and have an undefined default datasource

Because this will cause issues once Hibernate gets started even if there
no entities.
yrodiere added 3 commits July 4, 2025 13:03
Even if there are no entities, because we will soon start Hibernate
ORM/Reactive even if there are no entities, which would fail if the
datasource is not configured.
So that error messages are more precise, and so that this code can be
adapted more easily when we create persistence units even when there are
no entities.
Copy link

quarkus-bot bot commented Jul 4, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit f746fc6.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

quarkus-bot bot commented Jul 4, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit f746fc6.

Warning

Unable to include the stracktraces as the report was too long. See annotations below for the details.

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
Maven Tests - JDK 17 Build Failures Logs Raw logs 🔍
Maven Tests - JDK 17 Windows Build Failures Logs Raw logs 🔍

Full information is available in the Build summary check run.
You can consult the Develocity build scans.

Failures

⚙️ Maven Tests - JDK 17 #

- Failing: integration-tests/devmode 

📦 integration-tests/devmode

io.quarkus.test.component.ComponentContinuousTestingTest.test - History - More details - Source on GitHub

io.quarkus.test.devui.DevConsoleOidcJsonRPCTest.testGetProperties - History - More details - Source on GitHub

io.quarkus.test.devui.DevConsoleOidcNoDiscoveryJsonRPCTest.testGetProperties - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testAllAvailableData - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testBeans - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testObservers - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testRemovedBeans - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcJsonRPCTest.testEvents - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcJsonRPCTest.testInvocations - History - More details - Source on GitHub

io.quarkus.test.devui.DevUICacheJsonRPCTest.testCaches - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIContainerImageBuildTimeDataTest.testBuilderTypes - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIGrpcSmokeTest.testServices - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIGrpcSmokeTest.testTestService - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIQuteBuildTimeDataTest.testTemplates - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIReactiveMessagingJsonRPCTest.testProcessor - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIRestJsonRPCTest.testEndpoints - History - More details - Source on GitHub

io.quarkus.test.devui.DevUISchedulerJsonRPCTest.testExecuteJob - History - More details - Source on GitHub

io.quarkus.test.devui.DevUISchedulerJsonRPCTest.testScheduler - History - More details - Source on GitHub

io.quarkus.test.no.src.main.NoSrcMainDevModeTest.validateConfigBean - History - More details - Source on GitHub

io.quarkus.test.no.src.main.NoSrcMainUnitTest. - History - More details - Source on GitHub

io.quarkus.test.qute.QuteErrorPageTest.testErrorPage - History - More details - Source on GitHub

io.quarkus.test.qute.QuteWatchedResourceTest.testWatchedFiles - History - More details - Source on GitHub

io.quarkus.test.reload.AdditionalWatchedResourcesDevModeTest.globWatch - History - More details - Source on GitHub

io.quarkus.test.reload.AdditionalWatchedResourcesDevModeTest.notWatched - History - More details - Source on GitHub

io.quarkus.test.reload.AdditionalWatchedResourcesDevModeTest.watched - History - More details - Source on GitHub

io.quarkus.test.reload.AdditionalWatchedResourcesDevModeTest.watchedInSubPath - History - More details - Source on GitHub

io.quarkus.test.reload.AdditionalWatchedResourcesDevModeTest.watchedProfileSpecificConfigFile - History - More details - Source on GitHub

io.quarkus.test.reload.CrashAfterReloadTest.testRestarts line 39 - History - More details - Source on GitHub

io.quarkus.test.security.DisabledAuthorizationTest.verifyAuthorizationEnablement - History - More details - Source on GitHub

io.quarkus.test.vertx.ConsumeUuidEventHotReloadTest.testUuidMessageConsumption - History - More details - Source on GitHub

io.quarkus.test.vertx.MutinyVerticleClassnameHotReloadTest.testDeploymentOfMutinyVerticleClass - History - More details - Source on GitHub

io.quarkus.test.vertx.MutinyVerticleInstanceHotReloadTest.testDeploymentOfMutinyVerticleInstance - History - More details - Source on GitHub

io.quarkus.test.vertx.VerticleClassnameHotReloadTest.testDeploymentOfVerticleClass - History - More details - Source on GitHub

io.quarkus.test.vertx.VerticleInstanceHotReloadTest.testDeploymentOfVerticleInstance - History - More details - Source on GitHub


⚙️ Maven Tests - JDK 17 Windows #

- Failing: integration-tests/devmode 

📦 integration-tests/devmode

io.quarkus.test.component.ComponentContinuousTestingTest.test - History - More details - Source on GitHub

io.quarkus.test.devui.DevConsoleOidcJsonRPCTest.testGetProperties - History - More details - Source on GitHub

io.quarkus.test.devui.DevConsoleOidcNoDiscoveryJsonRPCTest.testGetProperties - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testAllAvailableData - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testBeans - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testObservers - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcBuildTimeDataTest.testRemovedBeans - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcJsonRPCTest.testEvents - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIArcJsonRPCTest.testInvocations - History - More details - Source on GitHub

io.quarkus.test.devui.DevUICacheJsonRPCTest.testCaches - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIContainerImageBuildTimeDataTest.testBuilderTypes - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIGrpcSmokeTest.testServices - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIGrpcSmokeTest.testTestService - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIQuteBuildTimeDataTest.testTemplates - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIReactiveMessagingJsonRPCTest.testProcessor - History - More details - Source on GitHub

io.quarkus.test.devui.DevUIRestJsonRPCTest.testEndpoints - History - More details - Source on GitHub

io.quarkus.test.devui.DevUISchedulerJsonRPCTest.testExecuteJob - History - More details - Source on GitHub

io.quarkus.test.devui.DevUISchedulerJsonRPCTest.testScheduler - History - More details - Source on GitHub

io.quarkus.test.no.src.main.NoSrcMainDevModeTest.validateConfigBean - History - More details - Source on GitHub

io.quarkus.test.no.src.main.NoSrcMainUnitTest. - History - More details - Source on GitHub

io.quarkus.test.qute.QuteErrorPageTest.testErrorPage - History - More details - Source on GitHub

io.quarkus.test.qute.QuteWatchedResourceTest.testWatchedFiles - History - More details - Source on GitHub

io.quarkus.test.reload.CrashAfterReloadTest.testRestarts line 39 - History - More details - Source on GitHub

io.quarkus.test.security.DisabledAuthorizationTest.verifyAuthorizationEnablement - History - More details - Source on GitHub

io.quarkus.test.vertx.ConsumeUuidEventHotReloadTest.testUuidMessageConsumption - History - More details - Source on GitHub

io.quarkus.test.vertx.MutinyVerticleClassnameHotReloadTest.testDeploymentOfMutinyVerticleClass - History - More details - Source on GitHub

io.quarkus.test.vertx.MutinyVerticleInstanceHotReloadTest.testDeploymentOfMutinyVerticleInstance - History - More details - Source on GitHub

io.quarkus.test.vertx.VerticleClassnameHotReloadTest.testDeploymentOfVerticleClass - History - More details - Source on GitHub

io.quarkus.test.vertx.VerticleInstanceHotReloadTest.testDeploymentOfVerticleInstance - History - More details - Source on GitHub

@yrodiere yrodiere added triage/on-ice Frozen until external concerns are resolved and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Jul 4, 2025
@yrodiere
Copy link
Member Author

yrodiere commented Jul 4, 2025

Status: on ice while I'm working on #48783, which I need if we want to avoid rewriting the dozens of failing tests above.

#48783 itself is on ice because I'll be away for the next two weeks.

@yrodiere yrodiere marked this pull request as draft July 4, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have a way to get access to EntityManager even without entities
5 participants