In the meantime I have found a different approach that works in 5.6. I used selectCase() to achieve what I needed: List<Order> orderStatements = new ArrayList<>(); orderStatements.add(cb.desc(cb.selectCase().when(cb.equal(root.get("rmgtnav_collection_type"), "PROFILE"), 0).otherwise(1))); |