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.una.zisc.cadastros.Cadastros.java

@SuppressWarnings("unchecked")
public void cadastraralerta(Usuario usuario, Alerta alerta) {
    Session s = HibernateUtil.getSessionFactory().getCurrentSession();
    try {/* w  ww .j a v a 2  s  .co  m*/
        s.beginTransaction();
        s.update(usuario);
        s.save(alerta);
        s.getTransaction().commit();
    } catch (RuntimeException e) {
        s.getTransaction().rollback();
    } finally {
        //s.close(); // finaliza a session
    }
}

From source file:br.unisal.dao.ConsultaDao.java

public void update(Consulta c) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {//w w  w .j a  v a  2 s.  c o  m
        tx.begin();
        session.update(c);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception ConsultaDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.EquipamentoDao.java

@Override
public void update(Equipamento s) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {/*from w w w  .ja  va  2 s  .c o m*/
        tx.begin();
        session.update(s);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception EquipamentoDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.MedicoDao.java

public void update(Medico m) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {//from   ww  w. j a va2 s  .c  om
        tx.begin();
        session.update(m);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception MedicoDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.PacienteDao.java

public void update(Paciente p) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {/*w  w w  .  j  av a  2 s  .  c o  m*/
        tx.begin();
        session.update(p);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception PacienteDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.ReuniaoDao.java

@Override
public void update(Reuniao r) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {/* www .  ja  v a2s . c  o  m*/
        tx.begin();
        session.update(r);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception ReuniaoDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.SalaDao.java

@Override
public void update(Sala s) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {//from w w w  . j av  a 2s .  c  o  m
        tx.begin();
        session.update(s);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception SalaDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.SensorDao.java

@Override
public void update(Sensor s) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {//from  w w w . j a v  a2  s  . c om
        tx.begin();
        session.update(s);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception SensorDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.dao.UsuarioDao.java

@Override
public void update(Usuario s) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {//from   w  w w  .java  2s  .c o m
        tx.begin();
        session.update(s);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception UsuarioDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}

From source file:br.unisal.twitter.dao.TweetDao.java

public void update(Tweet s) {
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {// www .  j a v a 2  s. co  m
        tx.begin();
        session.update(s);
        tx.commit();
    } catch (HibernateException e) {
        System.out.println("Exception TweetDao.update(): " + e.getMessage());
        tx.rollback();
    } finally {
        session.close();
    }
}