cq.where(condition, subCondition);
cq.distinct(asc);
if (asc) {
cq.orderBy(cb.asc(c.get(orderby)));
} else {
cq.orderBy(cb.desc(c.get(orderby)));
}
TypedQuery<Room> q = em.createQuery(cq);
q.setFirstResult(start);
q.setMaxResults(max);
List<Room> ll = q.getResultList();