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"));
}
}
Aggregations