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

Exception in panache, when using newline before from #31117

Closed
fedinskiy opened this issue Feb 13, 2023 · 8 comments · Fixed by #38931
Closed

Exception in panache, when using newline before from #31117

fedinskiy opened this issue Feb 13, 2023 · 8 comments · Fixed by #38931
Labels
area/panache kind/bug Something isn't working
Milestone

Comments

@fedinskiy
Copy link
Contributor

fedinskiy commented Feb 13, 2023

Describe the bug

I have an application, made with Hibrnate reactive and Panache. I run find method for HQL query with a new-line character before FROM clause. The operation fails with an exception.

Expected behavior

New lines in query should not affect the result

Actual behavior

An exception is thrown

How to Reproduce?

  1. Clone the reporducer: git clone [email protected]:fedinskiy/reproducer.git -b reproducer/hibernate-newline
  2. Start a DB in a separate terminal:
 docker run \
-e POSTGRESQL_USER=user \
-e POSTGRESQL_PASSWORD=user \
-e POSTGRESQL_DATABASE=mydb \
-e POSTGRES_USER=user \
-e POSTGRES_PASSWORD=user \
-e POSTGRES_DB=mydb \
-p 5432:5432 \
docker.io/library/postgres:15
  1. run the reproducer: mvn quarkus:dev
  2. Try to access the endpoint:
$ curl http://localhost:8080/library/by-author/Dlugi
{"code":500,"error":"begin 7, end -1, length 101"}
  1. edit file src/main/java/io/quarkus/ts/hibernate/reactive/http/PanacheEndpoint.java, add a space between \n and "FROM" on line 119
    6.$ curl http://localhost:8080/library/by-author/Dlugi [{"title":"Slovník"}]

Output of uname -a or ver

6.7.3-200.fc39.x86_64

Output of java -version

21.0.1, vendor: Eclipse Adoptium

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.7.1

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

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)

Additional information

See #29838 for a similar bug

@fedinskiy fedinskiy added the kind/bug Something isn't working label Feb 13, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 13, 2023

/cc @FroMage (panache), @loicmathieu (panache)

@fedinskiy fedinskiy changed the title Exception in panache, when using newline before from Exception in panache, when using newline before from Feb 13, 2023
@loicmathieu
Copy link
Contributor

This has been fixed by #31419

@fedinskiy
Copy link
Contributor Author

@loicmathieu I can reproduce it even on the latest(3.7.1) Quarkus version. The issue should be reopened.

@FroMage
Copy link
Member

FroMage commented Feb 9, 2024

Which module exactly are you using?

@fedinskiy
Copy link
Contributor Author

@FroMage do you mean extension? The reproduced, same as before, uses quarkus-reactive-pg-client, quarkus-hibernate-orm-panache-common, quarkus-hibernate-reactive and quarkus-hibernate-reactive-panache

@FroMage
Copy link
Member

FroMage commented Feb 12, 2024

OK, so this is with HR/Panache, whereas #31419 only tested this with Kotlin and ORM/Panache, so it's possible that the fix is missing in HR/Panache, reopening.

@FroMage FroMage reopened this Feb 12, 2024
@FroMage
Copy link
Member

FroMage commented Feb 15, 2024

I can reproduce on all releases and even main. I don't think this was fixed by #31419, nor by my current work on queries, no matter how much I improved them.
This was probably fixed for ORM in #29851 but not for HR.
I'll get to fixing it and making sure we test this.

@FroMage
Copy link
Member

FroMage commented Feb 15, 2024

This is actually all sorts of broken.

I tried to pass this job on to ORM, which now supports projections without new in the HQL query, exactly as we do, and this reveals that we've had tests that relied on doing a count query for projections that had distinct results for more than one column, which is not supported for count. This used to work because we mistakenly dropped the distinct keyword from the count query.

FroMage added a commit to FroMage/quarkus that referenced this issue Feb 21, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
FroMage added a commit to FroMage/quarkus that referenced this issue Feb 21, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
FroMage added a commit to FroMage/quarkus that referenced this issue Feb 21, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
FroMage added a commit to FroMage/quarkus that referenced this issue Jun 5, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
FroMage added a commit to FroMage/quarkus that referenced this issue Jun 7, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
@quarkus-bot quarkus-bot bot added this to the 3.12 - main milestone Jun 7, 2024
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Jul 31, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
danielsoro pushed a commit to danielsoro/quarkus that referenced this issue Sep 20, 2024
Problem is that there's a bug in ORM that disallows projections of
single columns, but that will be resolved by hibernate/hibernate-orm#7874

Fixes quarkusio#31117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/panache kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants