Example usage for org.hibernate Session load

List of usage examples for org.hibernate Session load

Introduction

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

Prototype

void load(Object object, Serializable id);

Source Link

Document

Read the persistent state associated with the given identifier into the given transient instance.

Usage

From source file:com.esteban.cmms.maven.model.Documentos_Model.java

public void deleteDocumento(int objid) {
    Transaction trns = null;//from w w w  .ja v a 2s .c  o  m
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Documentos obj = (Documentos) session.load(Documentos.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Imagenes_Model.java

/**
 * //from w ww.  jav a2 s  .  com
 * @param objid Un entero (int) para eliminar un imagen del sistema
 */
public void deleteImagen(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Imagenes obj = (Imagenes) session.load(Imagenes.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Localizaciones_Model.java

/**
 * Elimina una nica localidad de la base de datos de forma permanente
 * @param objid entero (int) para eliminar el registro
 */// w  w  w  .ja  v a2 s  .c  o m
public void deleteLocalizacion(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Localizaciones obj = (Localizaciones) session.load(Localizaciones.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Maquinas_Model.java

/**
 * Elimina una mquina de la base de datos
 * @param objid entero (int) del registro que se desea eliminar, este corresponde
 * a id en la tabla del registro que desea eliminar
 *//*from  w w  w  .ja va 2 s. c o m*/
public void deleteMaquina(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Maquinas obj = (Maquinas) session.load(Maquinas.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Proveedores_Model.java

/**
 * Elimina un proveedor de forma definitiva de la tabla en la base de datos
 * @param objid entero que corresponde al registro que quiere eliminar
 *//*from ww  w .  j a  v  a 2 s. c  om*/
public void deleteProveedor(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Proveedores obj = (Proveedores) session.load(Proveedores.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Roles_Model.java

public void deleteRol(int objid) {
    Transaction trns = null;//from w ww . ja v  a  2  s  .c  om
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Roles obj = (Roles) session.load(Roles.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Secciones_Model.java

/**
 * Elimina una seccin de forma definitiva de la tabla en la base de datos
 * @param objid entero que corresponde al registro que quiere eliminar
 *///from www .j a  v  a 2 s.c  o m
public void deleteSeccion(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Secciones obj = (Secciones) session.load(Secciones.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.TiposMaquinas_Model.java

/**
 * Elimina un tipo de mquina de forma definitiva de la tabla en la base de
 * datos//from w ww .  j a v  a  2 s .c  o  m
 *
 * @param objid entero que corresponde al registro que quiere eliminar
 */
public void deleteTipoMaquina(int tipomid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        TiposMaquinas tipom = (TiposMaquinas) session.load(TiposMaquinas.class, new Integer(tipomid));
        session.delete(tipom);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Usuarios_Model.java

/**
 * Elimina un usuario de forma definitiva de la tabla en la base de datos
 *
 * @param objid entero que corresponde al registro que quiere eliminar
 *//*from  ww w. j  a  va2s  . c o m*/
public void deleteUsuario(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Usuarios obj = (Usuarios) session.load(Usuarios.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}

From source file:com.esteban.cmms.maven.model.Vendedores_Model.java

/**
 * Elimina un vendedor de forma definitiva de la tabla en la base de
 * datos//from   ww w  .ja  v a 2  s  .  c  om
 *
 * @param objid entero que corresponde al registro que quiere eliminar
 */
public void deleteVendedor(int objid) {
    Transaction trns = null;
    Session session = HibernateUtil.getSessionFactory().openSession();
    try {
        trns = session.beginTransaction();
        Vendedores obj = (Vendedores) session.load(Vendedores.class, new Integer(objid));
        session.delete(obj);
        session.getTransaction().commit();
    } catch (RuntimeException e) {
        if (trns != null) {
            trns.rollback();
        }
        e.printStackTrace();
    } finally {
        session.flush();
        session.close();
    }
}