Krzysztof T (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNjM3ZDQyYWUz...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16757?atlOrigin=eyJpIjoiNjM3ZD...
) HHH-16757 (
https://hibernate.atlassian.net/browse/HHH-16757?atlOrigin=eyJpIjoiNjM3ZD...
) parameters from pageable are not correctly propagated to the final query after migration
from Hibernate 5.3.x to 6.0.0 (
https://hibernate.atlassian.net/browse/HHH-16757?atlOrigin=eyJpIjoiNjM3ZD...
)
Issue Type: Bug Affects Versions: 6.0.2 Assignee: Unassigned Components: query-criteria
Created: 06/Jun/2023 05:40 AM Environment: JVM: JDK 11/17 (Amazon Correto)
PostgresDB: 9.6.6
Spring Boot 2.7 / 3.0
OS: MacOs Priority: Critical Reporter: Krzysztof T (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Hello!
After the migration from Spring Boot *2.7.10* to Spring Boot *3.0.5* and from Hibernate
*5.6.0.Final* to Hibernate *6.2.2 Final*
The query form Spring-data-jpa for PostgreSQL is generated differently (please see link to
repo with branches + examples)
I am using JDK 17 Correto ( *17.07)* , and db is PostgreSQL *9.6.6*
Before migration generated SQL query looks like this:
select exportenti0_.uuid as uuid1_0_, exportenti0_.domain_uuid as domain_u2_0_,
exportenti0_.created_by as created_3_0_, exportenti0_.created_date as created_4_0_,
exportenti0_.updated_by as updated_5_0_, exportenti0_.updated_date as updated_6_0_,
exportenti0_.version as version7_0_, exportenti0_.currency_ex_uuid as currency8_0_,
exportenti0_.cutoff_time as cutoff_t9_0_, exportenti0_.data_domain_uid as data_do10_0_,
exportenti0_.is_force as is_forc11_0_, exportenti0_.status as status12_0_,
exportenti0_.is_use_latest_date as is_use_13_0_ from export exportenti0_ where
exportenti0_.domain_uuid=? order by exportenti0_.updated_date desc limit ?
– executes correctly.
After the migration the same query looks like follows:
{{ select e1_0.uuid, e1_0.created_by, e1_0.created_date, e1_0.currency_ex_uuid,
e1_0.cutoff_time, e1_0.data_domain_uid, e1_0.domain_uuid, e1_0.is_force, e1_0.status,
e1_0.updated_by, e1_0.updated_date, e1_0.is_use_latest_date, e1_0.version from export e1_0
where e1_0.domain_uuid=? order by e1_0.updated_date desc offset ? rows fetch first ? rows
only}}
Problem is with line *desc offset ..... rows only* which is added after query translation
from java model to SQL at the end.
As you may expected it crashes.
org.postgresql.util.PSQLException: ERROR: syntax error at or near "$3" Position:
328 at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
~ [postgresql-42.6.0.jar:42.6.0]
I am using the latest driver for postgreSQL, not sure what exactly is causing this issue.
Link to examples with issue:
Repo link (
https://github.com/Krzysztof1985/spring-boot3-jpa )
Thank you in advance!
Regards
Krzysztof
(
https://hibernate.atlassian.net/browse/HHH-16757#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16757#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:3b7cdab )