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:diagrama_de_base_de_datos.ParadaDAO.java

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

From source file:diagrama_de_base_de_datos.PuntoInteresDAO.java

public static java.util.Iterator iteratePuntoInteresByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.PuntoInteres as PuntoInteres");
    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  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:diagrama_de_base_de_datos.PuntoInteresDAO.java

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

From source file:diagrama_de_base_de_datos.TarifaDAO.java

public static java.util.Iterator iterateTarifaByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Tarifa as Tarifa");
    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());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.TarifaDAO.java

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

From source file:diagrama_de_base_de_datos.UsuarioDAO.java

public static java.util.Iterator iterateUsuarioByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Usuario as Usuario");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   ww w . j  a va2  s.  co  m*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.UsuarioDAO.java

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

From source file:edu.mgupi.pass.db.defects.DefectClassesFactory.java

public static java.util.Iterator iterateDefectClassesByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.defects.DefectClasses as DefectClasses");
    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  . c  om*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateDefectClassesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.defects.DefectClassesFactory.java

public static java.util.Iterator iterateDefectClassesByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.defects.DefectClasses as DefectClasses");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   www  .jav a 2 s .c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateDefectClassesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.defects.DefectsFactory.java

public static java.util.Iterator iterateDefectsByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.defects.Defects as Defects");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*ww  w .  ja  va2  s . c om*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateDefectsByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}