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

hbm2ddl create-schemas doesn't work when setting quarkus.hibernate-orm.database.default-schema #25244

Closed
vu-bui opened this issue Apr 29, 2022 · 11 comments
Labels
area/hibernate-orm Hibernate ORM kind/bug Something isn't working

Comments

@vu-bui
Copy link

vu-bui commented Apr 29, 2022

Describe the bug

The option quarkus.hibernate-orm.database.generation.create-schemas seems to doesn't work anymore since 2.6.3.Final. I'm not sure if it's caused by Hibernate upgrade or not.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

Darwin local 21.5.0 Darwin Kernel Version 21.5.0: Thu Apr 21 19:51:22 PDT 2022; root:xnu-8020.120.68.131.2~2/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.15" 2022-04-19

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.3.Final and newer

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

Gradle 7.4.2

Additional information

No response

@vu-bui vu-bui added the kind/bug Something isn't working label Apr 29, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 13, 2022

/cc @Sanne, @gsmet

@yrodiere
Copy link
Member

yrodiere commented Dec 22, 2022

It seems to work in our integration tests:

quarkus.hibernate-orm.database.generation.create-schemas=true

private static void listExistingPersons(EntityManager em) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Person> cq = cb.createQuery(Person.class);
Root<Person> from = cq.from(Person.class);
cq.select(from).orderBy(cb.asc(from.get("name")));
TypedQuery<Person> q = em.createQuery(cq);
List<Person> allpersons = q.getResultList();
if (allpersons.size() != 3) {
throw new RuntimeException("Incorrect number of results");
}
if (!allpersons.get(0).getName().equals("Gizmo")) {
throw new RuntimeException("Incorrect order of results");
}
StringBuilder sb = new StringBuilder("list of stored Person names:\n\t");
for (Person p : allpersons) {
p.describeFully(sb);
sb.append("\n\t");
if (p.getStatus() != Status.LIVING) {
throw new RuntimeException("Incorrect status " + p);
}
}
sb.append("\nList complete.\n");
System.out.print(sb);
}

Can you please provide a simple project that reproduces the problem?

Thank you.

@yrodiere yrodiere added the triage/needs-reproducer We are waiting for a reproducer. label Dec 22, 2022
@yrodiere
Copy link
Member

yrodiere commented Jan 2, 2023

This other issue suggests the problem is only when quarkus.hibernate-orm.database.generation is set to update. Was that your case?

@yrodiere
Copy link
Member

Bump. @vu-bui Can you give us a reproducer, or at least confirm your problem is the same as this one and occurs only when quarkus.hibernate-orm.database.generation is set to update?

@vu-bui
Copy link
Author

vu-bui commented Jan 27, 2023

@yrodiere Sorry for the late reply. I've created a repo here https://github.com/vu-bui/quarkus-hibernate-schema-generation.

What I found out was that quarkus.hibernate-orm.database.generation.create-schemas does not work with quarkus.hibernate-orm.database.default-schema. It works with Quarkus 2.6.2.Final and earlier.

It also works if I specifically define @Table(schema = "")

@yrodiere
Copy link
Member

Thanks a lot for the information and reproducer @vu-bui , it does seem related to some changes I'm familiar with. I will have a closer look.

@yrodiere yrodiere changed the title hbm2ddl create-schemas doesn't work hbm2ddl create-schemas doesn't work when setting quarkus.hibernate-orm.database.default-schema Jan 30, 2023
@yrodiere yrodiere removed the triage/needs-reproducer We are waiting for a reproducer. label Jan 30, 2023
@yrodiere
Copy link
Member

After some investigation, the problem seems to be upstream. I reported the problem: https://hibernate.atlassian.net/browse/HHH-16177
I will try to come up with a fix upstream.
Thanks again for the reproducer, that helped a lot.

@yrodiere
Copy link
Member

The bug was fixed upstream. It will be fixed in Quarkus as soon as we upgrade to either Hibernate ORM 5.6.16.Final or Hibernate ORM 6.2.0.Final (neither was released yet).

@michalvavrik
Copy link
Member

I presume this was closed with #32687, I'll write test in QE test suite, so will verify it later.

@Sanne
Copy link
Member

Sanne commented Jun 1, 2023

thanks @michalvavrik !

@yrodiere
Copy link
Member

yrodiere commented Jun 2, 2023

I presume this was closed with #32687, I'll write test in QE test suite, so will verify it later.

That's right, I forgot to close this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants