Example usage for org.hibernate Query setLockMode

List of usage examples for org.hibernate Query setLockMode

Introduction

In this page you can find the example usage for org.hibernate Query setLockMode.

Prototype

Query<R> setLockMode(String alias, LockMode lockMode);

Source Link

Document

Set the LockMode to use for specific alias (as defined in the query's FROM clause).

Usage

From source file:PeriodoEmpleadoEnObra.java

public static List queryPeriodoEmpleadoEnObra(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From PeriodoEmpleadoEnObra as PeriodoEmpleadoEnObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from w  w w . j  a  v a2 s.  c o  m
         Query query = session.createQuery(sb.toString());
         query.setLockMode("PeriodoEmpleadoEnObra", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:PeriodoEmpleadoEnObra.java

public static java.util.Iterator iteratePeriodoEmpleadoEnObraByQuery(PersistentSession session,
         String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From PeriodoEmpleadoEnObra as PeriodoEmpleadoEnObra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/* ww  w.  j ava 2 s .  c  o m*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("PeriodoEmpleadoEnObra", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Proveedor.java

public static List queryProveedor(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Proveedor as Proveedor");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from   w  w w .  j  av a  2 s  . c o m
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Proveedor", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Proveedor.java

public static java.util.Iterator iterateProveedorByQuery(PersistentSession session, String condition,
         String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Proveedor as Proveedor");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//  w ww .  j ava2s .  c o m
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Proveedor", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:EmpleadoAlmacen.java

public static List queryEmpleadoAlmacen(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From EmpleadoAlmacen as EmpleadoAlmacen");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/* w ww  . ja  v  a2 s  . co m*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("EmpleadoAlmacen", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:EmpleadoAlmacen.java

public static java.util.Iterator iterateEmpleadoAlmacenByQuery(PersistentSession session, String condition,
         String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From EmpleadoAlmacen as EmpleadoAlmacen");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/*from w w w.  j a  v a2s.com*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("EmpleadoAlmacen", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Material.java

public static List queryMaterial(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Material as Material");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/*from  w w w. j a  v a  2 s.  c o  m*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Material", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Material.java

public static java.util.Iterator iterateMaterialByQuery(PersistentSession session, String condition,
         String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Material as Material");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {//from   www .  j a va2  s  .  com
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Material", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Obra.java

public static List queryObra(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Obra as Obra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/*  w  ww.  ja v  a  2  s.  co  m*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Obra", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:Obra.java

public static java.util.Iterator iterateObraByQuery(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Obra as Obra");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {/*from www  . j a va2  s  . c o  m*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Obra", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }