use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class HibernateTurmaDAO method find.
@Override
public Turma find(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Turma turma = (Turma) session.get(Turma.class, id);
if (turma instanceof TurmaEfetiva) {
TurmaEfetiva turmaEfetiva = (TurmaEfetiva) turma;
fillTurmaEfetiva(session, turmaEfetiva);
}
return turma;
} catch (HibernateException e) {
Logger.getLogger(HibernateTurmaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("turmas.find.unique.error"));
}
}
use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class HibernateTurmaDAO method remove.
@Override
public void remove(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
Turma turma = find(id);
try {
session.delete(turma);
} catch (HibernateException e) {
Logger.getLogger(HibernateTurmaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("turmas.remove.error"));
}
}
Aggregations