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:businesslogic.distribution.Allocation_DAO.java

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

From source file:businesslogic.distribution.Allocation_DAO.java

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

From source file:businesslogic.distribution.requirement.RequirementDAO.java

public static java.util.Iterator iterateRequirementByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.requirement.Requirement as Requirement");
    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:businesslogic.distribution.requirement.RequirementDAO.java

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

From source file:businesslogic.distribution.resource.FinancialResourceDAO.java

public static java.util.Iterator iterateFinancialResourceByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.FinancialResource as FinancialResource");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  ww w  . ja va  2  s.  co m
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.distribution.resource.FinancialResourceDAO.java

public static java.util.Iterator iterateFinancialResourceByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.FinancialResource as FinancialResource");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  www  . ja va2s. com
        Query query = session.createQuery(sb.toString());
        query.setLockMode("FinancialResource", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.distribution.resource.HumanResourceDAO.java

public static java.util.Iterator iterateHumanResourceByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.HumanResource as HumanResource");
    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:businesslogic.distribution.resource.HumanResourceDAO.java

public static java.util.Iterator iterateHumanResourceByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.HumanResource as HumanResource");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from w w w.  j  av a2  s  . co  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("HumanResource", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.distribution.resource.InformationResourceDAO.java

public static java.util.Iterator iterateInformationResourceByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.InformationResource as InformationResource");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from w  ww.  j a v a2  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:businesslogic.distribution.resource.InformationResourceDAO.java

public static java.util.Iterator iterateInformationResourceByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.InformationResource as InformationResource");
    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());
        query.setLockMode("InformationResource", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}