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.com.itw.qopsearch.api.persistence.core.ProductRepositoryImpl.java

License:Apache License

@Override
public Product update(Product product) {
    Session session = (Session) entityManager.getDelegate();
    session.update(product);
    return product;
}

From source file:br.com.jn.dao.CandidatoDAO.java

public Boolean editar(Candidato candidato) {
    try {/*from   ww  w  .j a v  a  2 s . co m*/
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.update(candidato);
        session.getTransaction().commit();
        session.close();
        return true;
    } catch (HibernateException e) {
        System.out.println(e.toString());
        return false;
    }
}

From source file:br.com.jn.dao.UsersDAO.java

public Boolean editar(Users users) {
    try {//from  www.  j  a v  a  2 s.c o  m
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        session.update(users);
        session.getTransaction().commit();
        session.close();
        return true;
    } catch (HibernateException e) {
        System.out.println(e.toString());
        return false;
    }
}

From source file:br.com.livraria.dao.AutorDAO.java

public void editar(Autor autor) {
    Session sessao = HibernateUtil.getSessionFactory().openSession();
    Transaction transacao = null;//from w  ww.j a  v a2s. c o m

    try {
        transacao = sessao.beginTransaction();
        sessao.update(autor);
        transacao.commit();
    } catch (RuntimeException ex) {
        if (transacao != null) {
            transacao.rollback();
        }
        throw ex;
    } finally {
        sessao.close();
    }
}

From source file:br.com.livraria.dao.FuncionarioDAO.java

public void editar(Funcionario funcionario) {
    Session sessao = HibernateUtil.getSessionFactory().openSession();
    Transaction transacao = null;/*from w w  w.  j a va2  s. c  o  m*/

    try {
        transacao = sessao.beginTransaction();
        sessao.update(funcionario);
        transacao.commit();
    } catch (RuntimeException ex) {
        if (transacao != null) {
            transacao.rollback();
        }
        throw ex;
    } finally {
        sessao.close();
    }
}

From source file:br.com.livraria.dao.ItemDAO.java

public void editar(Item item) {
    Session sessao = HibernateUtil.getSessionFactory().openSession();
    Transaction transacao = null;//from w w w. ja  va  2 s  . c o  m

    try {
        transacao = sessao.beginTransaction();
        sessao.update(item);
        transacao.commit();
    } catch (RuntimeException ex) {
        if (transacao != null) {
            transacao.rollback();
        }
        throw ex;
    } finally {
        sessao.close();
    }
}

From source file:br.com.livraria.dao.VendaDAO.java

public void editar(Venda venda) {
    Session sessao = HibernateUtil.getSessionFactory().openSession();
    Transaction transacao = null;//from w w  w . j  a va  2 s .c  o m

    try {
        transacao = sessao.beginTransaction();
        sessao.update(venda);
        transacao.commit();
    } catch (RuntimeException ex) {
        if (transacao != null) {
            transacao.rollback();
        }
        throw ex;
    } finally {
        sessao.close();
    }
}

From source file:br.com.lsi.ordemservico.dao.DAOGeneric.java

@Override
public void atualizar(T t) throws DAOException {
    Session sessao = PersistenceUtil.getSessionFactory().openSession();
    try {/*w w  w  .jav a  2 s .c o  m*/
        sessao.getTransaction().begin();
        sessao.update(t);
        sessao.getTransaction().commit();
    } catch (Exception e) {
        sessao.getTransaction().rollback();
        e.printStackTrace();
        throw new DAOException("Erro ao Atualizar no BD");
    } finally {
        sessao.close();
    }
}

From source file:br.com.mandado.dao.BairroDAO.java

/**
 * @param bairro/* ww w. ja v a  2  s.  c  o m*/
 */
public void editar(Bairro bairro) {
    Session sessao = HibernateUtil.getSessionFactory().openSession();
    Transaction transacao = null;

    try {
        transacao = sessao.beginTransaction();
        sessao.update(bairro);
        transacao.commit();
    } catch (RuntimeException ex) {
        if (transacao != null) {
            transacao.rollback();
        }
        throw ex;
    } finally {
        sessao.close();
    }
}

From source file:br.com.mandado.dao.MandadoDAO.java

/**
 * @param mandado/*from ww  w  .  j a  v a2s .c  o  m*/
 */
public void editar(Mandado mandado) {
    Session sessao = HibernateUtil.getSessionFactory().openSession();
    Transaction transacao = null;

    try {
        transacao = sessao.beginTransaction();
        sessao.update(mandado);
        transacao.commit();
    } catch (RuntimeException ex) {
        if (transacao != null) {
            transacao.rollback();
        }
        throw ex;
    } finally {
        sessao.close();
    }
}