I thought about this workaround:
Case<String, Integer> orderCase = builder.selectCase() .when(builder.equal(root.get(Customer_.EMail), "test@test.com"), 1) .when(builder.equal(root.get(Customer_.EMail), "test2@test.com"), 2) .otherwise(0);
query.orderBy(builder.asc(orderCase));
em.createQuery(query);
But it does not work because of the bug https://hibernate.onjira.com/browse/HHH-4700
Please fix these annoying simple bugs.
I thought about this workaround:
Case<String, Integer> orderCase = builder.selectCase()
.when(builder.equal(root.get(Customer_.EMail), "test@test.com"), 1)
.when(builder.equal(root.get(Customer_.EMail), "test2@test.com"), 2)
.otherwise(0);
query.orderBy(builder.asc(orderCase));
em.createQuery(query);
But it does not work because of the bug https://hibernate.onjira.com/browse/HHH-4700
Please fix these annoying simple bugs.