long count = query.getSingleResult();
assertEquals(size, count);
}
public void testGeneralCase() {
DomainObject e = qb.createQueryDefinition(Employee.class);
e.where(e.get("department").get("name").equal("Engineering"));
e.select(e.get("name"),
e.generalCase()
.when(e.get("rating").equal(1))
.then(e.get("salary").times(1.1))
.when(e.get("rating").equal(2))
.then(e.get("salary").times(1.2))
.elseCase(e.get("salary").times(1.01)));
String jpql = "SELECT e.name,"
+ " CASE WHEN e.rating = 1 THEN e.salary * 1.1"
+ " WHEN e.rating = 2 THEN e.salary * 1.2"
+ " ELSE e.salary * 1.01"