Search in sources :

Example 6 with Turma

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"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) StatusTurmaEfetiva(com.tomasio.projects.trainning.model.StatusTurmaEfetiva) TurmaEfetiva(com.tomasio.projects.trainning.model.TurmaEfetiva) HibernateException(org.hibernate.HibernateException) Session(org.hibernate.Session)

Example 7 with Turma

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"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) HibernateException(org.hibernate.HibernateException) Session(org.hibernate.Session)

Aggregations

Turma (com.tomasio.projects.trainning.model.Turma)7 DAOException (com.tomasio.projects.trainning.exception.DAOException)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)4 Transactional (org.springframework.transaction.annotation.Transactional)4 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)2 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)2 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)2 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)2 TurmaPlanejada (com.tomasio.projects.trainning.model.TurmaPlanejada)2 ParseException (java.text.ParseException)2 HibernateException (org.hibernate.HibernateException)2 Session (org.hibernate.Session)2 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)1 TurmaPlanejadaDTO (com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO)1