CriteriaBuilder cast function example

Hey!

I accidentally found this post, while doing some migration from one service to another and all of a sudden as stopped working for me. So I thought it is good to update this post and let others know that starting 6.6 as won’t do the actual type conversion. In order to do so
org.hibernate.query.criteria.JpaExpression#cast(Class) can be used.
https://docs.jboss.org/hibernate/orm/6.6/migration-guide/migration-guide.html#criteria-query

4 Likes