Reputation: 9
regarding Quarkus version 3.6.6,
Checking out the quickstart from here https://github.com/quarkusio/quarkus-quickstarts.git
On hibernate-orm-panache-quickstart: Edit the application.properties with this content:
quarkus.datasource.query.db-kind=postgresql
quarkus.hibernate-orm.query.datasource=query
quarkus.hibernate-orm.query.packages=org.acme.hibernate.orm.panache.entity,org.acme.hibernate.orm.panache.repository
quarkus.hibernate-orm.query.database.generation=drop-and-create
quarkus.hibernate-orm.query.log.sql=true
quarkus.hibernate-orm.query.sql-load-script=import.sql
Run the test: FAILED
java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#configurationDescriptorBuilding threw an exception: io.quarkus.runtime.configuration.ConfigurationException: Model classes are defined for the default persistence unit, but no default datasource was found. The default EntityManagerFactory will not be created. To solve this, configure the default datasource. Refer to https://quarkus.io/guides/datasource for guidance.
Edit the application.properties with this content:
quarkus.datasource.query-service.db-kind=postgresql
quarkus.hibernate-orm.query-service.datasource=query-service
quarkus.hibernate-orm.query-service.packages=org.acme.hibernate.orm.panache.entity,org.acme.hibernate.orm.panache.repository
quarkus.hibernate-orm.query-service.database.generation=drop-and-create
quarkus.hibernate-orm.query-service.log.sql=true
quarkus.hibernate-orm.query-service.sql-load-script=import.sql
Run the test: PASS
Does the "query" is a reserved word ? Maybe the error should be more explicative on it - or maybe it should bé possible to name a datasource query.
Regards, Damien
Upvotes: 0
Views: 169
Reputation: 9977
As @zforgo mentioned, this is probably Quarkus config getting confused by the fact that other configuration properties exist that start with quarkus.hibernate-orm.query
. I opened https://github.com/quarkusio/quarkus/issues/38321 to address this, though I'm not sure it's possible to fix it.
Maybe you can try using quotes around query
to resolve the ambiguity (that's generally a good practice for names in configuration property keys):
quarkus.datasource."query".db-kind=postgresql
quarkus.hibernate-orm."query".datasource=query
quarkus.hibernate-orm."query".packages=org.acme.hibernate.orm.panache.entity,org.acme.hibernate.orm.panache.repository
quarkus.hibernate-orm."query".database.generation=drop-and-create
quarkus.hibernate-orm."query".log.sql=true
quarkus.hibernate-orm."query".sql-load-script=import.sql
I haven't tried though, so I'm not sure it will work.
Upvotes: 0