EntityTransaction tx = session.getTransaction();
tx.begin();
CriteriaBuilder cb = session.getCriteriaBuilder();
CriteriaQuery<Rooms> cq = cb.createQuery(Rooms.class);
Root<Rooms> c = cq.from(Rooms.class);
Predicate condition = cb.equal(c.get("deleted"), "false");
Predicate subCondition = cb.equal(c.get("externalRoomType"), externalRoomType);
cq.where(condition, subCondition);
cq.distinct(asc);
if (asc){
cq.orderBy(cb.asc(c.get(orderby)));
} else {