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.defects.DefectsFactory.java

public static java.util.Iterator iterateDefectsByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) 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 {/* w  ww  .  j  av  a  2 s.  c o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateDefectsByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

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

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

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

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

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

public static java.util.Iterator iterateDefectTypePropertiesByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.defects.DefectTypeProperties as DefectTypeProperties");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from  www.  j  ava2 s.co  m*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateDefectTypePropertiesByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

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

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

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

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

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

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

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

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

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

public static java.util.Iterator iterateLFiltersByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.LFilters as LFilters");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from w w  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("iterateLFiltersByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

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

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