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.CanalDAO.java

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

From source file:diagrama_bd.base_de_datos.ClienteDAO.java

public static java.util.Iterator iterateClienteByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Cliente as Cliente");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*  w ww. j a  va2s.  co  m*/
        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.ClienteDAO.java

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

From source file:diagrama_bd.base_de_datos.ComercialDAO.java

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

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

From source file:diagrama_bd.base_de_datos.FacturaDAO.java

public static java.util.Iterator iterateFacturaByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Factura as Factura");
    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:diagrama_bd.base_de_datos.FacturaDAO.java

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

From source file:diagrama_bd.base_de_datos.IncidenciaDAO.java

public static java.util.Iterator iterateIncidenciaByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Incidencia as Incidencia");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   ww  w. j a  va  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_bd.base_de_datos.IncidenciaDAO.java

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

From source file:diagrama_bd.base_de_datos.ServicioDAO.java

public static java.util.Iterator iterateServicioByQuery(PersistentSession session, String condition,
        String orderBy) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_bd.base_de_datos.Servicio as Servicio");
    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 o  m
        Query query = session.createQuery(sb.toString());
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}