Felix König (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5a4bad5...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNGVhZTFlMzVj...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16239?atlOrigin=eyJpIjoiNGVhZT...
) HHH-16239 (
https://hibernate.atlassian.net/browse/HHH-16239?atlOrigin=eyJpIjoiNGVhZT...
) Queries with LIKE-filters always return empty results with H2 database in Oracle
Compatibility Mode (
https://hibernate.atlassian.net/browse/HHH-16239?atlOrigin=eyJpIjoiNGVhZT...
)
Issue Type: Bug Affects Versions: 6.1.7 Assignee: Unassigned Components: hibernate-core
Created: 28/Feb/2023 04:43 AM Labels: H2 Priority: Major Reporter: Felix König (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5a4bad5...
)
https://hibernate.atlassian.net/browse/HHH-15736 (
https://hibernate.atlassian.net/browse/HHH-15736 ) (merge request
https://github.com/hibernate/hibernate-orm/pull/5746 (
https://github.com/hibernate/hibernate-orm/pull/5746 ) ) introduced a regression for
LIKE-queries in H2 databases running in ORACLE-compatibility mode.
Setting escape '' successfully disables the escape character if running H2 in its
default configuration. However, when running H2 in Oracle compatibility mode, H2 fails to
return any results.
I opened an issue with H2 (
https://github.com/h2database/h2database/issues/3745 (
https://github.com/h2database/h2database/issues/3745 ) ), and it seems users are advised
against attempting to use escape ‘' in Oracle-compatibility mode. But starting with
hibernate 6.1.7, this possibly illegal use of escape '' is now the default
behaviour.
*Workaround* : Explicitly set a non-null escape character for LIKE-expressions, so the
newly introduced special case does not get executed.
*Possible solution* : Detect whether H2 is running in Oracle Compatibility Mode, and skip
the newly introduced special case then.
(
https://hibernate.atlassian.net/browse/HHH-16239#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16239#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#100217- sha1:65be9f2 )