Brett Meyer commented on an issue
Hibernate ORM / Bug HHH-7277
Problem with expressions in criteria CASE WHEN OTHERWISE
JPA/Hibernate is not allowing to use an expression in WHEN and OTHERWISE clause of CASE statement. Following is criteria code, generated JPQL and the error it is throwing

Case<String> sectorCase = cb.selectCase();
sectorCase.when(cb.notEqual(sectors.get(Sectors_.sectorName), Constants.ACCOUNT_TYPE_RESIDENTIAL), root.get(Customers_.customerName)).
       ...