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

public static java.util.Iterator iterateAlbaranByQuery(PersistentSession session, String condition,
         String orderBy) 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.  ja  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: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 {//  ww  w .j a va2s. 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 java.util.Iterator iteratePeriodoJefeObraEnObraByQuery(PersistentSession session,
         String condition, String orderBy) 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 {/*from w w w . j  a  v  a2 s .c om*/
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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 {/*from  w ww .j  ava  2 s. co m*/
         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 java.util.Iterator iterateLineaAlbaranByQuery(PersistentSession session, String condition,
         String orderBy) 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  ww .j a v  a2s.  c o m
         Query query = session.createQuery(sb.toString());
         return query.iterate();
     } 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 {//w  w  w.  j  a  v  a2s. c  o 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 java.util.Iterator iterateEmpleadoObraByQuery(PersistentSession session, String condition,
         String orderBy) 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  w w.  j av  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: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 av  a 2 s .c o  m
         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 java.util.Iterator iterateJefeDeObraByQuery(PersistentSession session, String condition,
         String orderBy) 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  a v a 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: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 {//  ww w . jav  a  2s.  c o m
         Query query = session.createQuery(sb.toString());
         query.setLockMode("JefeDeObra", lockMode);
         return query.iterate();
     } catch (Exception e) {
         e.printStackTrace();
         throw new PersistentException(e);
     }
 }