hql += " DESC";
}
Object idf = PersistenceSessionUtil.createSession();
EntityManager session = PersistenceSessionUtil.getSession();
EntityTransaction tx = session.getTransaction();
tx.begin();
Query query = session.createQuery(hql);
query.setParameter("toUserId", toUserId);
query.setParameter("isTrash", false);
query.setParameter("privateMessageFolderId", privateMessageFolderId);
if (search.length() != 0) {
query.setParameter("search", StringUtils.lowerCase("%"+search+"%"));
}
query.setFirstResult(start);
query.setMaxResults(max);
List<PrivateMessages> ll = query.getResultList();
tx.commit();
PersistenceSessionUtil.closeSession(idf);
return ll;
} catch (Exception e) {
log.error("[getPrivateMessagesByUser]",e);