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

panache reactive quarkus.hibernate-orm.packages not working #28576

Closed
JungeMachAn opened this issue Oct 13, 2022 · 5 comments · Fixed by #28632
Closed

panache reactive quarkus.hibernate-orm.packages not working #28576

JungeMachAn opened this issue Oct 13, 2022 · 5 comments · Fixed by #28632

Comments

@JungeMachAn
Copy link

JungeMachAn commented Oct 13, 2022

Describe the bug

When I set quarkus.hibernate-orm.packages in my config file :

quarkus.hibernate-orm.packages=my.custom.entities.package

Table for entities from other package are still created in the DB at startup

Expected behavior

Entities that are declared in packages that are not in the specified package should not be created in DB.

Actual behavior

All entities from the project are created in DB

How to Reproduce?

  1. setup a basic Quarkus project with panache reactive
    
  2. add a line to the configuration to specify a value for quarkus.hibernate-orm.packages
    
  3. create one entity that is in the specified package and one that is not
    
  4. start quarkus
    
  5. verify that both entities have been created in the DB
    

Here is a reproducer: https://github.com/JungeMachAn/QuarkusPanachReactivePackageTest

Output of uname -a or ver

Darwin mac-awalth.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 x86_64

Output of java -version

openjdk version "11.0.14.1" 2022-02-08 LTS OpenJDK Runtime Environment Zulu11.54+25-CA (build 11.0.14.1+1-LTS) OpenJDK 64-Bit Server VM Zulu11.54+25-CA (build 11.0.14.1+1-LTS, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.13.2.Final

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

Apache Maven 3.8.1

Additional information

No response

@quarkus-bot
Copy link

quarkus-bot bot commented Oct 13, 2022

@DavideD
Copy link
Contributor

DavideD commented Oct 13, 2022

I think Quarkus is not starting an instance of postgres because you've specified the URL. It assumes the instance is already running and when Hibernate Reactive tries to create the schema, it fails because there's not a db running.

It will work if you change the property to:

%prod.quarkus.datasource.reactive.url = vertx-reactive:postgresql://localhost:5432/postgres

I've added the prefix %prod..
I couldn't find a place where we mention this in the docs though. Maybe we should add a note somewhere.

@JungeMachAn
Copy link
Author

JungeMachAn commented Oct 13, 2022

There is no problem with starting the application. If i write the %prod it starts the database with the dev mode but creates both entities. It should create just one entity and should ignore the other one because I set the quarkus.hibernate-orm.packages=de.teckpro.test.person.

This issue was fixed in the non-reactive panache but exists in the reactive:
#21682

@DavideD
Copy link
Contributor

DavideD commented Oct 14, 2022

Ah, I see, sorry about that.
I will have a look.

@DavideD DavideD self-assigned this Oct 14, 2022
@yrodiere yrodiere assigned yrodiere and unassigned DavideD Oct 17, 2022
yrodiere pushed a commit to yrodiere/quarkus that referenced this issue Oct 17, 2022
yrodiere added a commit to yrodiere/quarkus that referenced this issue Oct 17, 2022
yrodiere added a commit to yrodiere/quarkus that referenced this issue Oct 17, 2022
yrodiere added a commit to yrodiere/quarkus that referenced this issue Oct 17, 2022
yrodiere pushed a commit to yrodiere/quarkus that referenced this issue Oct 17, 2022
@quarkus-bot quarkus-bot bot added this to the 2.14 - main milestone Oct 17, 2022
@DavideD
Copy link
Contributor

DavideD commented Oct 17, 2022

Thanks!

@gsmet gsmet modified the milestones: 2.14 - main, 2.13.3.Final Oct 18, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 18, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 18, 2022
tmihalac pushed a commit to tmihalac/quarkus that referenced this issue Oct 27, 2022
tmihalac pushed a commit to tmihalac/quarkus that referenced this issue Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants