class DBAlertManager extends DBManager<Alert> implements AlertManager {

    @Override
    public final List<Alert> getAlertsForBaseline(final Baseline baseline)
            throws AlertManagerException {
        LOGGER.debug("");

        if (baseline == null) {
            throw new NullPointerException("baseline was null");
        }

        List<Alert> alerts = new ArrayList<>();
        Transaction tx = null;
        Session session = getFactory().getCurrentSession();
        try {
            tx = session.beginTransaction();

            // query hibernate to retrieve alerts with the given baseline id
            Criteria criteria = session.createCriteria(Alert.class);
            criteria.add(Restrictions.eq("baselineId", baseline.getId()));
            criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
            List list = criteria.list();
            for (Object o : list) {
                if (o instanceof Alert) {
                    alerts.add((Alert) o);
                }
            }
            tx.commit();

        } catch (HibernateException e) {
            final String msg = "unable to query alerts table";
            LOGGER.error(msg, e);
            if (tx != null) {
                LOGGER.debug("rolling back transaction");
                tx.rollback();
            }
            throw e;
        }

        return alerts;
    }

    public  DBAlertManager(final SessionFactory factory);

}