Hi The following part of code:
{code:java} CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Entity> q = criteriaBuilder.createQuery(Entity.class); Root<Entity> caseRoot = q.from(Entity.class); Expression<String> field= criteriaBuilder .substring(criteriaBuilder.function("replace", String.class, caseRoot.get("field"), criteriaBuilder.literal('1'), criteriaBuilder.literal('1')), 1, 2); Predicate equal = criteriaBuilder.equal(= , "1"); entityManager.createQuery(q).getResultList(); {code}
is producing this SQL output : substring(replacebis(caseeb0_.psi_case_id, ?, ?)). As you can notice, the 2 parameters of substring are not written
I've notice that is the function replace is declared using registerFunction in a dialect, this will works fine, but if not declared, this is not workings. For example, this will works with H2Dialect but not with SQLServer
Seems a duplicate of HHH-4963 |
|