Search in sources :

Example 6 with AtividadeAdministrativa

use of com.tomasio.projects.trainning.model.AtividadeAdministrativa in project trainning by fernandotomasio.

the class HibernateAtividadeAdministrativaDAO method findAll.

@Override
public List<AtividadeAdministrativa> findAll(Long pudId) throws DAOException {
    Session session = sessionFactory.getCurrentSession();
    try {
        Criteria criteria = session.createCriteria(AtividadeAdministrativa.class);
        criteria.add(Restrictions.eq("curriculoMinimo.id", pudId));
        criteria.addOrder(Order.asc("numero"));
        @SuppressWarnings("unchecked") List<AtividadeAdministrativa> atividades = criteria.list();
        return atividades;
    } catch (HibernateException e) {
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
        throw new DAOException(MessageHelper.getMessage("complementacoes.find.list.error"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) HibernateException(org.hibernate.HibernateException) Criteria(org.hibernate.Criteria) AtividadeAdministrativa(com.tomasio.projects.trainning.model.AtividadeAdministrativa) Session(org.hibernate.Session)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)6 AtividadeAdministrativa (com.tomasio.projects.trainning.model.AtividadeAdministrativa)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)4 Transactional (org.springframework.transaction.annotation.Transactional)4 HibernateException (org.hibernate.HibernateException)2 Session (org.hibernate.Session)2 AtividadeAdministrativaDTO (com.tomasio.projects.trainning.dto.AtividadeAdministrativaDTO)1 Criteria (org.hibernate.Criteria)1