Example usage for org.hibernate Session delete

List of usage examples for org.hibernate Session delete

Introduction

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

Prototype

void delete(Object object);

Source Link

Document

Remove a persistent instance from the datastore.

Usage

From source file:Anbulategi.ErrezetaDAOHibernate.java

public void delete(Errezeta errezeta) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {/* ww w  . j  ava2  s  .  co m*/
        session.beginTransaction();
        session.delete(errezeta);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }

}

From source file:Anbulategi.EspezialistaDAOHibernate.java

@Override
public void delete(Espezialista espezialista) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {/*  w ww. j a  v a 2s.  c  om*/
        session.beginTransaction();
        session.delete(espezialista);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }

}

From source file:Anbulategi.GaixoaDAOHibernate.java

@Override
public void delete(Gaixoa gaixo) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {//from  w  w w . j  av  a  2  s.com
        session.beginTransaction();
        session.delete(gaixo);
        session.getTransaction().commit();
    } catch (Exception ex) {
        ex.printStackTrace();
        session.getTransaction().rollback();
    }

}

From source file:Anbulategi.HistorialDAOHibernate.java

@Override
public void delete(Historial historiala) {

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

From source file:Anbulategi.IdazkariaDAOHibernate.java

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

}

From source file:Anbulategi.SendagileaDAOHibernate.java

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

}

From source file:angeldx.manager.EstudianteManager.java

public boolean eliminar(int id) {
    Session session = HibernateUtil.openSession();
    Transaction tx = null;/*from  w w  w.  j  a v a  2s  . c  o  m*/
    try {
        tx = session.beginTransaction();
        Estudiante est = (Estudiante) session.load(Estudiante.class, new Integer(id));
        session.delete(est);
        tx.commit();
    } catch (RuntimeException e) {
        if (tx != null) {
            tx.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
    return true;
}

From source file:app.core.PersistentObject.java

License:Open Source License

public void delete() {
    Session session = Db.getSession();
    session.delete(this);
}

From source file:app.Ejer1.java

public static void deleteSeguro(Seguro seguro) {
    SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
    Session session = sessionFactory.openSession();

    session.beginTransaction();/*from  w w  w .j a  va  2 s . c  om*/
    session.delete(seguro);
    session.getTransaction().commit();

    session.close();

}

From source file:app.Ejer2.java

public static void deleteSeguro(SeguroAnotaciones seguro) {
    SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
    Session session = sessionFactory.openSession();

    session.beginTransaction();/* w w w  . j  av  a2s.c o  m*/
    session.delete(seguro);
    session.getTransaction().commit();

    session.close();

}