Search in sources :

Example 6 with Anotacao

use of com.tomasio.projects.trainning.model.Anotacao in project trainning by fernandotomasio.

the class HibernateAnotacaoDAO method create.

@Override
public Long create(AnotacaoDTO anotacao) throws DAOException {
    Session session = sessionFactory.getCurrentSession();
    try {
        Anotacao _anotacao = new Anotacao(anotacao);
        Long anotacaoId = (Long) session.save(_anotacao);
        return anotacaoId;
    } catch (HibernateException e) {
        Logger.getLogger(HibernateAnotacaoDAO.class.getName()).log(Level.SEVERE, null, e);
        throw new DAOException(MessageHelper.getMessage("anotacoes.create.error"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) HibernateException(org.hibernate.HibernateException) Anotacao(com.tomasio.projects.trainning.model.Anotacao) Session(org.hibernate.Session)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)6 Anotacao (com.tomasio.projects.trainning.model.Anotacao)6 HibernateException (org.hibernate.HibernateException)6 Session (org.hibernate.Session)6 AnotacaoDTO (com.tomasio.projects.trainning.dto.AnotacaoDTO)3 ArrayList (java.util.ArrayList)3