Quarkus: SQL import script not loaded in neither profile (prod, dev, test)

Created on 22 Feb 2020  路  5Comments  路  Source: quarkusio/quarkus

Neither of the scenarios works for me as it goes to loading the SQL file:

  • import.sql file in src/main/resources in profile DEV, TEST, PROD
  • import.sql file in src/test/resources in profile DEV, TEST, PROD

I also tried all the properties:

  • %dev.quarkus.hibernate-orm.sql-load-script = db/data-test.sql
  • %test.quarkus.hibernate-orm.sql-load-script = db/data-test.sql

When no file is present I get the exception that the property is not pointing to the actual file:,

Caused by: io.quarkus.deployment.configuration.ConfigurationError: Unable to find file referenced in 'quarkus.hibernate-orm.sql-load-script=db/data-test-bad.sql'. Remove property or add file to your path.

but when I fix the path the file is not loaded anyways. I even added some no-SQL statement hoping to see errors, but nothing happens.

Environment (please complete the following information):

  • Output of java -version: JDK 11
  • GraalVM version (if different from Java): JDK11
  • Quarkus version or git rev: 1.2.1.Final

    • Postgres

Additional context

  • Flyway migrations get executed properly during the startup.

Related to:

3661

6545

7290

kinbug

Most helpful comment

I did find the same issue, until I've realized that Hibernate only runs the import file if the database.generation is set to create. Not sure if this is the issue of the @kolorobot, but maybe it is.

All 5 comments

Could you provide a reproducer? Thanks!

@gsmet: I prepared the sample so you can test every scenario I described. The only thing: run the postgres server (docker command in project's README) before starting the application.

https://github.com/kolorobot/quarkus-postgres-sample

Thanks @kolorobot

I'll take a look tonight

Looking at this real quick, it seems like ParsedPersistenceXmlDescriptor get's populated with the proper file.

Also the runtime logs for Hibernate do show that hibernate.hbm2ddl.import_files uses the proper value. I could dig more but it probably makes more sense for someone with Hibernate internals knowledge to check, they will definitely be able to make faster progress than me :)

I did find the same issue, until I've realized that Hibernate only runs the import file if the database.generation is set to create. Not sure if this is the issue of the @kolorobot, but maybe it is.

Was this page helpful?
0 / 5 - 0 ratings