I was trying to execute a JPA Criteria Query using Hibernate 6 calling the datediff function, but it seems that due to the cast to SqmDurationUnit in TimestampdiffFunction->TimestampdiffFunctionReturnTypeResolver I’m unable to supply a temporal unit that will be accepted. Given an entityManager the following demonstrates it when it throws an exception with the failed cast:
Caused by: java.lang.ClassCastException: class org.hibernate.query.sqm.tree.expression.SqmLiteral cannot be cast to class org.hibernate.query.sqm.tree.expression.SqmDurationUnit at org.hibernate.dialect.function.TimestampdiffFunction$TimestampdiffFunctionReturnTypeResolver.resolveFunctionReturnType(TimestampdiffFunction.java:133)
|