use of com.tomasio.projects.trainning.model.CurriculoMinimo in project trainning by fernandotomasio.
the class HibernateCurriculoMinimoDAO method findAllCurosWithCurriculosMinimos.
@Override
public List<Curso> findAllCurosWithCurriculosMinimos() throws DAOException {
Session session = sessionFactory.getCurrentSession();
List<Curso> result = new ArrayList<Curso>();
try {
@SuppressWarnings("unchecked") List<CurriculoMinimo> curriculos = session.createQuery("from CurriculoMinimo c where c.curso != null ").list();
Set<Curso> cursosSet = new HashSet<Curso>();
for (CurriculoMinimo curriculoMinimo : curriculos) {
cursosSet.add(curriculoMinimo.getCurso());
}
for (Curso curso : cursosSet) {
result.add(curso);
}
return result;
} catch (HibernateException e) {
Logger.getLogger(HibernateIndicacaoDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("cursos.find.list.error"));
}
}
Aggregations