use of com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO in project trainning by fernandotomasio.
the class HibernateItemPlanejamentoDAO method findAll.
@Override
public List<ItemPlanejamentoDTO> findAll(Long planejamentoId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
@SuppressWarnings("unchecked") List<ItemPlanejamento> items = session.createQuery("from ItemPlanejamento item " + " where item.planejamento.id=:param order by item.curso.codigo").setLong("param", planejamentoId).list();
List<ItemPlanejamentoDTO> dto = new ArrayList<ItemPlanejamentoDTO>();
for (ItemPlanejamento item : items) {
ItemPlanejamentoDTO itemDTO = item.createDTOWithoutDependencies();
dto.add(itemDTO);
}
return dto;
} catch (HibernateException e) {
Logger.getLogger(HibernateItemPlanejamentoDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("planejamento.itens.find.list.error"));
}
}
Aggregations