Example usage for org.hibernate Query iterate

List of usage examples for org.hibernate Query iterate

Introduction

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

Prototype

Iterator<R> iterate();

Source Link

Document

Return the query results as an Iterator.

Usage

From source file:PeriodoEmpleadoEnObra.java

public static java.util.Iterator iteratePeriodoEmpleadoEnObraByQuery(PersistentSession session,
         String condition, String orderBy) 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());
         return query.iterate();
     } 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 {//from w ww  . j  ava  2s  .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 java.util.Iterator iterateProveedorByQuery(PersistentSession session, String condition,
         String orderBy) 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  ww.java  2  s.  c  om
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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 {//from   w w  w  .ja va2s. com
         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 java.util.Iterator iterateEmpleadoAlmacenByQuery(PersistentSession session, String condition,
         String orderBy) 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 va2s  . c o  m
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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 {// w ww .j a  va2s  . c  o  m
         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 java.util.Iterator iterateMaterialByQuery(PersistentSession session, String condition,
         String orderBy) 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 ww . j  a  va  2s .  c  om
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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 {//  www . j  a va  2 s. c  o  m
         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 java.util.Iterator iterateObraByQuery(PersistentSession session, String condition, String orderBy)
         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   ww  w. j  a v a 2 s  .co m
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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  av  a  2 s.com
         Query query = session.createQuery(sb.toString());
         query.setLockMode("Obra", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }