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

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

From source file:Albaran.java

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

From source file:PeriodoJefeObraEnObra.java

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

From source file:PeriodoJefeObraEnObra.java

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

From source file:LineaAlbaran.java

public static List queryLineaAlbaran(PersistentSession session, String condition, String orderBy,
         org.hibernate.LockMode lockMode) throws PersistentException {
     StringBuffer sb = new StringBuffer("From LineaAlbaran as LineaAlbaran");
     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("LineaAlbaran", lockMode);
         return query.list();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }

From source file:LineaAlbaran.java

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

From source file:EmpleadoObra.java

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

From source file:EmpleadoObra.java

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

From source file:JefeDeObra.java

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

From source file:JefeDeObra.java

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