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.accounting.job.ResourceManagementDAO.java

public static java.util.Iterator iterateResourceManagementByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.accounting.ResourceManagement as ResourceManagement");
    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 om*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.job.ResourceManagementDAO.java

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

From source file:businesslogic.accounting.job.SpecialtyDAO.java

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

From source file:businesslogic.accounting.job.SpecialtyDAO.java

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

From source file:businesslogic.accounting.job.UserJobDAO.java

public static java.util.Iterator iterateUserJobByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.job.UserJob as UserJob");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from  w w w. ja va2s  .  com*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.job.UserJobDAO.java

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

From source file:businesslogic.accounting.job.UserPermissionDAO.java

public static java.util.Iterator iterateUserPermissionByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.job.UserPermission as UserPermission");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   w ww. 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.accounting.job.UserPermissionDAO.java

public static java.util.Iterator iterateUserPermissionByQuery(PersistentSession session, String condition,
        String orderBy, LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.job.UserPermission as UserPermission");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// w ww. ja v a2s  .  c o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("UserPermission", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.user.AdminDAO.java

public static java.util.Iterator iterateAdminByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.user.Admin as Admin");
    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 . co m*/
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.user.AdminDAO.java

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