For 6.6.x.Final versions the {h-schema} is no longer replaced with a configured value and the query breaks. This could be because of the use of ' characters, but that is a guess. Removing the ' causes the {h-schema} to be properly replaced, but then the query will not work since it is no longer proper.
Attachments
1
28 Feb 2025, 02:42 PM
Activity
Bjørn HilstadApril 1, 2025 at 8:24 AM
Problem is still there in version 6.6.12.Final
Bjørn HilstadFebruary 28, 2025 at 2:44 PM
I have added a reproducer using just Hibernate. Just run the single test in the project and observe the error that will show the query that was attempted.
Just switch between working and non-working hibernate versions in the file gradle.properties to observe that version 6.5.3.Final correctly replaces {h-schema} in the native query, while version 6.6.9.Final does not.
Bjørn HilstadFebruary 6, 2025 at 1:01 PM
Some more info: The Query in the example is org.springframework.data.jpa.repository.Query and I discovered this issue while upgrading a project from spring-boot 3.3.7 to 3.4.2, which updates Hibernate from 6.5.3.Final to 6.6.5.Final.
I kept spring-boot at 3.4.2 and downgraded Hibernate to 6.5.3.Final to test the issue and that solved it. I also tested all the mentioned 6.6.x.Final versions mentioned in the issue and the problem was there. Which is why I am pointing the finger at Hibernate here.
This query works in 6.5.3.Final (and previous versions):
@Query(value = "select nextval('{h-schema}internal_id_seq')", nativeQuery = true)
For 6.6.x.Final versions the
{h-schema}
is no longer replaced with a configured value and the query breaks. This could be because of the use of'
characters, but that is a guess. Removing the'
causes the{h-schema}
to be properly replaced, but then the query will not work since it is no longer proper.