Search in sources :

Example 6 with ItemAta

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

the class HibernateItemAtaDAO method findAllByUser.

@SuppressWarnings("unchecked")
@Override
public List<ItemAtaDTO> findAllByUser(String user) throws DAOException {
    Session session = sessionFactory.getCurrentSession();
    try {
        List<ItemAta> itens_atas = session.createQuery("from ItemAta itemAta" + " where itemAta.user=:user order by itemAta.dataCriacao desc").setString("user", user).list();
        List<ItemAtaDTO> dto = new ArrayList<ItemAtaDTO>();
        for (ItemAta item_ata : itens_atas) {
            dto.add(item_ata.createDTO());
        }
        return dto;
    } catch (HibernateException e) {
        Logger.getLogger(HibernateItemAtaDAO.class.getName()).log(Level.SEVERE, null, e);
        throw new DAOException(MessageHelper.getMessage("itens_atas.find.list.error"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) ItemAta(com.tomasio.projects.trainning.model.ItemAta) HibernateException(org.hibernate.HibernateException) ItemAtaDTO(com.tomasio.projects.trainning.dto.ItemAtaDTO) ArrayList(java.util.ArrayList) Session(org.hibernate.Session)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)6 ItemAta (com.tomasio.projects.trainning.model.ItemAta)6 HibernateException (org.hibernate.HibernateException)5 Session (org.hibernate.Session)5 ItemAtaDTO (com.tomasio.projects.trainning.dto.ItemAtaDTO)3 Acao (com.tomasio.projects.trainning.model.Acao)3 Comentario (com.tomasio.projects.trainning.model.Comentario)3 Decisao (com.tomasio.projects.trainning.model.Decisao)3 ArrayList (java.util.ArrayList)3 AcaoDTO (com.tomasio.projects.trainning.dto.AcaoDTO)2 ComentarioDTO (com.tomasio.projects.trainning.dto.ComentarioDTO)2 DecisaoDTO (com.tomasio.projects.trainning.dto.DecisaoDTO)2 ItemAtaDAO (com.tomasio.projects.trainning.dao.ItemAtaDAO)1 CoreException (com.tomasio.projects.trainning.exeption.CoreException)1 Transactional (org.springframework.transaction.annotation.Transactional)1