use of org.jbei.ice.storage.model.Comment in project ice by JBEI.
the class CommentDAO method getCommentCount.
public int getCommentCount(Entry entry) {
try {
CriteriaQuery<Long> query = getBuilder().createQuery(Long.class);
Root<Comment> from = query.from(Comment.class);
query.select(getBuilder().countDistinct(from.get("id"))).where(getBuilder().equal(from.get("entry"), entry));
return currentSession().createQuery(query).uniqueResult().intValue();
} catch (HibernateException he) {
Logger.error(he);
throw new DAOException(he);
}
}
use of org.jbei.ice.storage.model.Comment in project ice by JBEI.
the class CommentDAO method retrieveComments.
public List<Comment> retrieveComments(Entry entry) {
try {
CriteriaQuery<Comment> query = getBuilder().createQuery(Comment.class);
Root<Comment> from = query.from(Comment.class);
query.select(from).where(getBuilder().equal(from.get("entry"), entry));
return currentSession().createQuery(query).list();
} catch (HibernateException he) {
Logger.error(he);
throw new DAOException(he);
}
}
Aggregations