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:Anbulategi.GaixoaDAOHibernate.java

@Override
public void edit(Gaixoa gaixo) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {//from ww  w  .  j  a v a2  s. c  o m
        session.beginTransaction();
        session.update(gaixo);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }
}

From source file:Anbulategi.HistorialDAOHibernate.java

@Override
public void edit(Historial historiala) {

    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {/*from  www .j  ava 2 s. c  o m*/
        session.beginTransaction();
        session.update(historiala);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }
}

From source file:Anbulategi.IdazkariaDAOHibernate.java

@Override
public void edit(Idazkaria idazkari) {

    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {//  w  w w  .  j a  va2 s  .  c om
        session.beginTransaction();
        session.update(idazkari);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }

}

From source file:Anbulategi.SendagileaDAOHibernate.java

@Override
public void edit(Sendagilea sendagile) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {/*from w  w  w  .  ja v  a  2  s. co  m*/
        session.beginTransaction();
        session.update(sendagile);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }
}

From source file:app.datos.servicios.implementacion.ClienteServiceImpl.java

License:Open Source License

@Override
@Transactional(rollbackFor = PersistenciaException.class)
public void modificarCliente(Cliente cliente) throws PersistenciaException {
    Session session = getSessionFactory().getCurrentSession();
    try {/* ww w.  j  ava2  s  .  c om*/
        session.update(cliente);
    } catch (Exception e) {
        throw new SaveUpdateException(e);
    }
}

From source file:app.datos.servicios.implementacion.DatosServiceImpl.java

License:Open Source License

@Override
@Transactional(readOnly = true, rollbackFor = PersistenciaException.class)
public ArrayList<Localidad> obtenerLocalidadesDe(Provincia provincia) throws PersistenciaException {
    ArrayList<Localidad> localidades = new ArrayList<>();
    Session session = getSessionFactory().getCurrentSession();
    try {/*ww  w  .  ja v a 2 s .c  o  m*/
        session.update(provincia);
        for (Object o : session.getNamedQuery("obtenerLocalidadesDe").setParameter("prov", provincia).list()) {
            if (o instanceof Localidad) {
                localidades.add((Localidad) o);
            }
        }
    } catch (Exception e) {
        throw new ConsultaException(e);
    }
    return localidades;
}

From source file:app.datos.servicios.implementacion.DatosServiceImpl.java

License:Open Source License

@Override
@Transactional(readOnly = true, rollbackFor = PersistenciaException.class)
public ArrayList<Provincia> obtenerProvinciasDe(Pais pais) throws PersistenciaException {
    ArrayList<Provincia> provincias = new ArrayList<>();
    Session session = getSessionFactory().getCurrentSession();
    try {//from ww w. j  av a2 s  . c  om
        session.update(pais);
        for (Object o : session.getNamedQuery("obtenerProvinciasDe").setParameter("pa", pais).list()) {
            if (o instanceof Provincia) {
                provincias.add((Provincia) o);
            }
        }
    } catch (Exception e) {
        throw new ConsultaException(e);
    }
    return provincias;
}

From source file:app.datos.servicios.implementacion.DatosServiceImpl.java

License:Open Source License

@Override
@Transactional(readOnly = true, rollbackFor = PersistenciaException.class)
public ArrayList<Barrio> obtenerBarriosDe(Localidad localidad) throws PersistenciaException {
    ArrayList<Barrio> barrios = new ArrayList<>();
    Session session = getSessionFactory().getCurrentSession();
    try {/*from   w  ww  . ja va 2s  .c o m*/
        session.update(localidad);
        for (Object o : session.getNamedQuery("obtenerBarriosDe").setParameter("loc", localidad).list()) {
            if (o instanceof Barrio) {
                barrios.add((Barrio) o);
            }
        }
    } catch (Exception e) {
        throw new ConsultaException(e);
    }
    return barrios;
}

From source file:app.datos.servicios.implementacion.DatosServiceImpl.java

License:Open Source License

@Override
@Transactional(readOnly = true, rollbackFor = PersistenciaException.class)
public ArrayList<Calle> obtenerCallesDe(Localidad localidad) throws PersistenciaException {
    ArrayList<Calle> calles = new ArrayList<>();
    Session session = getSessionFactory().getCurrentSession();
    try {/*from  w w w . ja v  a  2  s .  c o  m*/
        session.update(localidad);
        for (Object o : session.getNamedQuery("obtenerCallesDe").setParameter("loc", localidad).list()) {
            if (o instanceof Calle) {
                calles.add((Calle) o);
            }
        }
    } catch (Exception e) {
        throw new ConsultaException(e);
    }
    return calles;
}

From source file:app.datos.servicios.implementacion.InmuebleServiceImpl.java

License:Open Source License

@Override
@Transactional(rollbackFor = PersistenciaException.class)
public void modificarInmueble(Inmueble inmueble) throws PersistenciaException {
    Session session = getSessionFactory().getCurrentSession();
    try {// www.j  a va  2s.c o m
        session.update(inmueble);
    } catch (Exception e) {
        throw new SaveUpdateException(e);
    }
}