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:AdministrativoObra.java

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

From source file:AdministrativoObra.java

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

From source file:Empleado.java

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

From source file:Empleado.java

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

From source file:PeriodoMaquinariaEnObra.java

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

From source file:PeriodoMaquinariaEnObra.java

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

From source file:Maquinaria.java

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

From source file:Maquinaria.java

public static java.util.Iterator iterateMaquinariaByQuery(PersistentSession session, String condition,
         String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From Maquinaria as Maquinaria");
     if (condition != null)
         sb.append(" Where ").append(condition);
     if (orderBy != null)
         sb.append(" Order By ").append(orderBy);
     try {// w w  w . ja v a2 s  . c  om
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Maquinaria", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:MaterialParaObra.java

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

From source file:MaterialParaObra.java

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