Skip to content

The quarkus-spring-data-jpa throw Datasource must be defined for persistence unit '<default>' #50793

@jedla97

Description

@jedla97

Describe the bug

Since 3.29.0 we spot in some of our test that when quarkus-spring-data-jpa is added. The build fail with Datasource must be defined for persistence unit '<default>'. Setting the datasource for the persistence unit can be done via the 'quarkus.hibernate-orm.datasource' property. Refer to https://quarkus.io/guides/datasource for guidance.

This happen only when the quarkus-jdbc-* is not present or there are multiple of them and at the same time the import.sql is present. Without the import.sql the build passing.

Expected behavior

I would expect that the Quarkus app is build without problem as it was done in 3.28

Actual behavior

The application fail to build with

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (default-cli) on project quarkus-reproducers: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#configurationDescriptorBuilding threw an exception: io.quarkus.runtime.configuration.ConfigurationException: Datasource must be defined for persistence unit '<default>'. Setting the datasource for the persistence unit can be done via the 'quarkus.hibernate-orm.datasource' property.  Refer to https://quarkus.io/guides/datasource for guidance.
[ERROR]         at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.collectDialectConfig(HibernateOrmProcessor.java:1056)
[ERROR]         at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.producePersistenceUnitDescriptorFromConfig(HibernateOrmProcessor.java:997)
[ERROR]         at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.handleHibernateORMWithNoPersistenceXml(HibernateOrmProcessor.java:905)
[ERROR]         at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.configurationDescriptorBuilding(HibernateOrmProcessor.java:382)
[ERROR]         at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:872)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:255)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2651)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2630)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1622)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1589)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)

How to Reproduce?

  1. git clone -b spring-jpa-hibernate [email protected]:jedla97/quarkus-reproducers.git
  2. cd quarkus-reproducers
  3. quarkus build

Output of uname -a or ver

Linux fedowa 6.16.10-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct 2 19:23:55 UTC 2025 x86_64 GNU/Linux

Output of java -version

OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7

Quarkus version or git rev

3.29.0, main

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)

Additional information

It maybe related to #50247 but not 100% sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/hibernate-ormHibernate ORMarea/springIssues relating to the Spring integrationkind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions