I'm developing a Quarkus 3 application where I've integrated Hibernate 6. To work with custom PostgreSQL types, specifically tstzrange, I've incorporated hypersistence-utils-hibernate-62 from hypersistence-utils. This serves as a replacement for the older hibernate-types.
However looks like now I can not use upper() and lower() functions anymore in JPQ, for example:
List<Restriction> resultList = entityManager.createQuery(
"from AgeRestriction where upper(rangeZonedDateTime) is not null",
Restriction.class
).getResultList();
Here, rangeZonedDateTime is defined as a tstzrange type. When executing this, I encounter the following error:
java.lang.IllegalArgumentException: org.hibernate.QueryException: Parameter 1 of function upper() has type STRING,
but argument is of type io.hypersistence.utils.hibernate.type.range.Range
It seems like Hibernate now interprets the upper() function as a string manipulation function (to convert characters to uppercase), rather than a function to get the upper bound of the tstzrange.
I've tried setting up a custom dialects in the application's configuration, but it doesn't seem to make any difference,, for example:
quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQLDialect
Basically, I just extended this test: https://github.com/vladmihalcea/hypersistence-utils/blob/master/hypersistence-utils-hibernate-62/src/test/java/io/hypersistence/utils/hibernate/type/range/ZonedDateTimeMilliSecondTest.java
Is it still possible to use upper/lower for range types in JPQL in Hibernate 6.x ?