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

public static java.util.Iterator iterateAdministrativoObraByQuery(PersistentSession session, String condition,
         String orderBy) 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 w  w.  ja v a 2s  . com*/
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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   w  w  w.  j a  v  a 2  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 java.util.Iterator iterateEmpleadoByQuery(PersistentSession session, String condition,
         String orderBy) 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  .  ja  v a  2 s  . com*/
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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 ww . java2 s  .  c o 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 java.util.Iterator iteratePeriodoMaquinariaEnObraByQuery(PersistentSession session,
         String condition, String orderBy) 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  ww w .ja  va  2s. c o  m
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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   ww  w .j  av  a  2 s.c  o  m*/
         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 java.util.Iterator iterateMaquinariaByQuery(PersistentSession session, String condition,
         String orderBy) 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 {/*from  w  w  w .  j a  v a 2 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: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 {/*from w  w w . j a v a  2 s  .co m*/
         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 java.util.Iterator iterateMaterialParaObraByQuery(PersistentSession session, String condition,
         String orderBy) 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  a v a 2  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: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 {/*www.  j a v a  2 s  . c  om*/
         Query query = session.createQuery(sb.toString());
         query.setLockMode("MaterialParaObra", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }