use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class HibernateConclusaoDAO method remove.
@Override
public void remove(Long conclusaoId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
Conclusao conclusao = (Conclusao) session.get(Conclusao.class, conclusaoId);
try {
session.delete(conclusao);
} catch (HibernateException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("conclusoes.remove.error"));
}
}
use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class HibernateCertificadoConclusaoDAO method hasCertificadosConclusaoByTurma.
@Override
public boolean hasCertificadosConclusaoByTurma(Long turmaId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Long countCertificadoConclusao = 0L;
// buscar todas as conclusoes da turma
@SuppressWarnings("unchecked") List<Conclusao> conclusoes = session.createQuery("from Conclusao conclusao " + "where conclusao.matricula.turma.id=:turmaId " + "and conclusao.comAproveitamento=:aproveitamento").setLong("turmaId", turmaId).setBoolean("aproveitamento", true).list();
@SuppressWarnings("unused") List<CertificadoConclusao> certificados = new ArrayList<CertificadoConclusao>();
// loop nas conclusoes pegando as que possuem certificado
for (Conclusao conclusao : conclusoes) {
@SuppressWarnings("unchecked") List<CertificadoConclusao> certificadosConclusao = session.createQuery("" + "from CertificadoConclusao c " + "where c.conclusao.id=:conclusaoId ").setLong("conclusaoId", conclusao.getId()).list();
for (@SuppressWarnings("unused") CertificadoConclusao certificado : certificadosConclusao) {
countCertificadoConclusao++;
}
}
return countCertificadoConclusao > 0;
} catch (HibernateException e) {
Logger.getLogger(HibernateMatriculaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("certificadoConclusao.list.error"));
}
}
Aggregations