Example usage for org.hibernate Session update

List of usage examples for org.hibernate Session update

Introduction

In this page you can find the example usage for org.hibernate Session update.

Prototype

void update(Object object);

Source Link

Document

Update the persistent instance with the identifier of the given detached instance.

Usage

From source file:br.uece.goes.model.ObjectDAO.java

public void update(Object p) {

    Session s = openSession();
    s.beginTransaction();
    s.update(p);
    s.getTransaction().commit();
    s.close();
}

From source file:br.ufg.calendario.dao.CalendarioDao.java

@Transactional
public boolean atualizar(Calendario calendario) {
    Session session = sessionFactory.getCurrentSession();
    try {//from   w  w  w  . j  a  va2s .co m
        session.update(calendario);
        if (calendario.isAtivo() == true) {
            disableOthers(session, calendario);
        }
        return true;
    } catch (HibernateException e) {
        System.out.println(e.getMessage());
        session.clear();
        return false;
    }
}

From source file:br.ufg.calendario.dao.EventoDao.java

@Transactional
public boolean atualizar(Evento evento) {
    Session session = sessionFactory.getCurrentSession();
    try {/*from  w w  w. java  2 s  .c om*/
        session.clear();
        session.update(evento);
        return true;
    } catch (HibernateException e) {
        System.out.println(e.getMessage());
        session.clear();
        return false;
    }
}

From source file:br.ufg.calendario.dao.InteressadoDao.java

@Transactional
public boolean atualizar(Interessado interessado) {
    Session session = this.sessionFactory.getCurrentSession();
    try {/*from   ww w.j  a  va2s.  c  o  m*/
        session.update(interessado);
        return true;
    } catch (HibernateException e) {
        System.out.println(e.getMessage());
        session.clear();
        return false;
    }
}

From source file:br.ufg.calendario.dao.RegionalDao.java

@Transactional
public boolean atualizar(Regional regional) {
    Session session = sessionFactory.getCurrentSession();
    try {/*from  w w  w .  j av a2s. c o  m*/
        session.update(regional);
        return true;
    } catch (HibernateException e) {
        System.out.println(e.getMessage());
        return false;
    }
}

From source file:br.ufg.calendario.dao.UsuarioDao.java

@Transactional
public boolean atualizar(Usuario usuario) {
    Session session = sessionFactory.getCurrentSession();
    try {// ww w .j  a va2 s. co  m
        session.clear();
        session.update(usuario);
        return true;
    } catch (HibernateException e) {
        System.out.println(e.getMessage());
        session.clear();
        return false;
    }
}

From source file:br.ufg.inf.es.fs.contpatri.persistencia.dao.GenericDAOImpl.java

License:GNU General Public License

@Override
public void update(T entity) {
    try {/* w w w. j  a  v a 2  s .  co m*/
        HibernateUtil.beginTransaction();
        Session hibernateSession = this.getSession();
        hibernateSession.update(entity);
        HibernateUtil.commitTransaction();
    } catch (HibernateException e) {
        HibernateUtil.rollbackTransaction();
        throw e;
    }
}

From source file:br.ufg.inf.es.fs.contpatri.web.persistencia.dao.GenericDAOImpl.java

License:GNU General Public License

@Override
public void update(T entity) {
    Session hibernateSession = this.getSession();
    hibernateSession.update(entity);
}

From source file:br.ufg.reqweb.dao.PeriodoDao.java

@Transactional
public void atualizar(Periodo periodo) {
    Session session = this.sessionFactory.getCurrentSession();
    session.update(periodo);
    if (periodo.isAtivo() == true) {
        disableOthers(session, periodo);
    }/*from  www  .ja  va2s . c  o  m*/
}

From source file:br.ufg.reqweb.dao.RequerimentoDao.java

@Transactional
public void atualizar(Requerimento requerimento) {
    Session session = this.sessionFactory.getCurrentSession();
    requerimento.setDataModificacao(Calendar.getInstance().getTime());
    session.update(requerimento);
}