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:entities.Group_detail.java

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

From source file:entities.Group_right.java

public static java.util.Iterator iterateGroup_rightByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Group_right as Group_right");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//  www  .  j  ava  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:entities.Group_right.java

public static java.util.Iterator iterateGroup_rightByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Group_right as Group_right");
    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  .  co m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Group_right", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:entities.Group_user.java

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

From source file:entities.Group_user.java

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

From source file:entities.Parish.java

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

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

From source file:entities.Polling_station.java

public static java.util.Iterator iteratePolling_stationByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Polling_station as Polling_station");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from w w w  .  ja v a 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:entities.Polling_station.java

public static java.util.Iterator iteratePolling_stationByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Polling_station as Polling_station");
    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.com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Polling_station", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:entities.Sub_county.java

public static java.util.Iterator iterateSub_countyByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Sub_county as Sub_county");
    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);
    }
}