What about the criteria.add(Restrictions.sqlRestriction()) option? I’ve started a branch to migrate my company’s code to Hibernate 6 (Hibernate Criteria to JPA basically), but I can’t complete this migration without an sql restriction alternative. We are using only criteria, no HQL. I’ve got very far and thought of possible alternative solutions, but in the end, although we have just 31 usages in a very large project, I could only migrate a few of them to other solutions, for all the rest, a replacement to SQL Restriction is absolutely needed. |