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:diagrama_bd.base_de_datos.TipoIncidenciaDAO.java

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

From source file:diagrama_bd.base_de_datos.TipoTerminalDAO.java

public static java.util.Iterator iterateTipoTerminalByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.TipoTerminal as TipoTerminal");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//  ww w  .  ja  v a2  s . c  om
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_bd.base_de_datos.TipoTerminalDAO.java

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

From source file:diagrama_de_base_de_datos.BarrioDAO.java

public static java.util.Iterator iterateBarrioByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Barrio as Barrio");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//w ww . ja v  a  2s . c o  m
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.BarrioDAO.java

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

From source file:diagrama_de_base_de_datos.ConsultaDAO.java

public static java.util.Iterator iterateConsultaByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Consulta as Consulta");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  w  w w.java 2s .c om
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.ConsultaDAO.java

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

From source file:diagrama_de_base_de_datos.DescargaDAO.java

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

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

From source file:diagrama_de_base_de_datos.DireccionDAO.java

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