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:edu.mgupi.pass.db.locuses.LocusesFactory.java

public static java.util.Iterator iterateLocusesByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.Locuses as Locuses");
    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  . c  o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateLocusesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusModuleDataFactory.java

public static java.util.Iterator iterateLocusModuleDataByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.LocusModuleData as LocusModuleData");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from ww w.j  av  a2  s. c o m*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateLocusModuleDataByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusModuleDataFactory.java

public static java.util.Iterator iterateLocusModuleDataByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.LocusModuleData as LocusModuleData");
    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 .  c om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateLocusModuleDataByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusSourcesFactory.java

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

From source file:edu.mgupi.pass.db.locuses.LocusSourcesFactory.java

public static java.util.Iterator iterateLocusSourcesByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.LocusSources as LocusSources");
    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("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateLocusSourcesByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.sensors.SensorClassesFactory.java

public static java.util.Iterator iterateSensorClassesByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.sensors.SensorClasses as SensorClasses");
    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) {
        _logger.error(
                "iterateSensorClassesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.sensors.SensorClassesFactory.java

public static java.util.Iterator iterateSensorClassesByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.sensors.SensorClasses as SensorClasses");
    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());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateSensorClassesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.sensors.SensorsFactory.java

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

From source file:edu.mgupi.pass.db.sensors.SensorsFactory.java

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

From source file:edu.mgupi.pass.db.sensors.SensorTypesFactory.java

public static java.util.Iterator iterateSensorTypesByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.sensors.SensorTypes as SensorTypes");
    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("iterateSensorTypesByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}