Search in sources :

Example 6 with Audit

use of org.jbei.ice.storage.model.Audit in project ice by JBEI.

the class AuditDAO method getHistoryCount.

public int getHistoryCount(Entry entry) {
    try {
        CriteriaQuery<Long> query = getBuilder().createQuery(Long.class);
        Root<Audit> from = query.from(Audit.class);
        query.select(getBuilder().countDistinct(from.get("id"))).where(getBuilder().equal(from.get("entry"), entry));
        return currentSession().createQuery(query).uniqueResult().intValue();
    } catch (HibernateException e) {
        Logger.error(e);
        throw new DAOException(e);
    }
}
Also used : DAOException(org.jbei.ice.storage.DAOException) Audit(org.jbei.ice.storage.model.Audit) HibernateException(org.hibernate.HibernateException)

Aggregations

Audit (org.jbei.ice.storage.model.Audit)6 HibernateException (org.hibernate.HibernateException)3 DAOException (org.jbei.ice.storage.DAOException)3 Date (java.util.Date)1 History (org.jbei.ice.lib.dto.History)1 Results (org.jbei.ice.lib.dto.common.Results)1 AccountDAO (org.jbei.ice.storage.hibernate.dao.AccountDAO)1 Account (org.jbei.ice.storage.model.Account)1