Skip to content
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

Make an explicit section on Hibernate ORM in production with the different defaults #5463

Closed
fmarchioni opened this issue Nov 14, 2019 · 8 comments · Fixed by #5469
Closed
Assignees
Labels
Milestone

Comments

@fmarchioni
Copy link

The default import.sql file is not executed when running in Native mode. According to the docs, Hibernate ORM, upon boot, will read and execute the SQL statements in the /import.sql file (if present).
That works in JVM Mode. In native mode the script is not executed. As workaround, you have to set explicitly the property:
quarkus.hibernate-orm.sql-load-script=import.sql
I have used this project to reproduce the issue: https://bit.ly/32Iw7Zh

Environment:
Quarkus 1.0.0.CR1

$ uname -a
Linux fedora 4.18.16-300.fc29.x86_64 #1 SMP Sat Oct 20 23:24:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

GraalVM: graalvm-ce-19.2.0

$GRAALVM_HOME/bin/java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-20190711120915.buildslave.jdk8u-src-tar--b08)
OpenJDK 64-Bit GraalVM CE 19.2.0 (build 25.222-b08-jvmci-19.2-b02, mixed mode)

@fmarchioni fmarchioni added the kind/bug Something isn't working label Nov 14, 2019
@emmanuelbernard
Copy link
Member

Use %prod.quarkus.hibernate-orm.sql-load-script=import.sql if you really want import.sql to be used in production and thus in java -jar or native.
My experience is that this behavior is only useful for demos.

See https://quarkus.io/guides/hibernate-orm#quarkus-hibernate-orm_quarkus.hibernate-orm.sql-load-script

@emmanuelbernard emmanuelbernard added the triage/invalid This doesn't seem right label Nov 14, 2019
@Sanne Sanne self-assigned this Nov 14, 2019
@Sanne
Copy link
Member

Sanne commented Nov 14, 2019

@emmanuelbernard don't rush it please - @fmarchioni mentioned it's working differently in JVM mode, that's not expected.

@fmarchioni please confirm it's different when running in JVM / production? Or did you only compare /dev mode?

@Sanne Sanne removed the triage/invalid This doesn't seem right label Nov 14, 2019
@emmanuelbernard
Copy link
Member

Note that in my demos, what I described worked as expected with 0.28.1 aka 1.0.0.CR1

@fmarchioni
Copy link
Author

@emmanuelbernard @Sanne
I have compared JVM mode for both prod and dev. In JVM Prod mode (mvn package -Dquarkus.profile=prod; java -jar target/app-RUNNER.jar) the import.sql script is not executed as well.
So I guess with @emmanuelbernard clarification this can be closed. Maybe it could be worth mentioning about the %prod.quarkus.hibernate-orm.sql-load-script=import.sql in the docs though.

@Sanne
Copy link
Member

Sanne commented Nov 14, 2019

Thanks @fmarchioni . This is actually mentioned in the docs - I guess you were expecting it in a different location?

Please point me to were you'd have expected to see such a note.

@emmanuelbernard
Copy link
Member

@fmarchioni
Copy link
Author

fmarchioni commented Nov 14, 2019 via email

@emmanuelbernard emmanuelbernard changed the title Default import.sql not executed when running in Native Mode Make an explicit section on Hibernate ORM in production with the different defaults Nov 14, 2019
@emmanuelbernard emmanuelbernard added kind/enhancement New feature or request area/documentation and removed kind/bug Something isn't working labels Nov 14, 2019
@Sanne
Copy link
Member

Sanne commented Nov 14, 2019

Fixed by #5469

@Sanne Sanne closed this as completed Nov 14, 2019
@gsmet gsmet added this to the 1.0.0.Final milestone Nov 14, 2019
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 a pull request may close this issue.

4 participants