*/
private List getRoomsOrganisationByOrganisationId(long organisation_id, int start, int max, String orderby, boolean asc){
try {
Object idf = PersistenceSessionUtil.createSession();
EntityManager session = PersistenceSessionUtil.getSession();
EntityTransaction tx = session.getTransaction();
tx.begin();
String hql = "select c from Rooms_Organisation as c " +
"where c.organisation.organisation_id = :organisation_id " +
"AND c.deleted <> :deleted";
if (orderby.startsWith("c.")){
hql += "ORDER BY "+orderby;
} else {
hql += "ORDER BY " + "c." + orderby;
}
if (asc) {
hql += " ASC";
} else {
hql += " DESC";
}
Query q = session.createQuery(hql);
q.setParameter("organisation_id", organisation_id);
q.setParameter("deleted", "true");
q.setFirstResult(start);
q.setMaxResults(max);
List<Rooms_Organisation> ll = q.getResultList();
tx.commit();
PersistenceSessionUtil.closeSession(idf);
return ll;
} catch (Exception ex2) {
log.error("[getRoomsByOrganisation] ", ex2);