Example usage for org.hibernate Query setLockMode

List of usage examples for org.hibernate Query setLockMode

Introduction

In this page you can find the example usage for org.hibernate Query setLockMode.

Prototype

Query<R> setLockMode(String alias, LockMode lockMode);

Source Link

Document

Set the LockMode to use for specific alias (as defined in the query's FROM clause).

Usage

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 {/*  ww  w .j ava 2s.  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 List queryBarrio(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 {//w w  w  . j a va2s. c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Barrio", lockMode);
        return query.list();
    } 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 w ww.ja va 2 s.co 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 List queryConsulta(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 {//  w  ww .  j a  v  a2  s  .  co  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Consulta", lockMode);
        return query.list();
    } 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 ww  . j  a  va  2 s.  c o  m*/
        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 List queryDescarga(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 {/*w  w  w. ja  v a 2s .co  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Descarga", lockMode);
        return query.list();
    } 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 {/*ww  w.jav a 2  s .  c  om*/
        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 List queryDireccion(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) 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 {//  ww w  .ja va  2  s  . c o m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Direccion", lockMode);
        return query.list();
    } 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, org.hibernate.LockMode lockMode) 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 {/*from  ww w  . j  a v  a2s  .  com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Direccion", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.EventoDAO.java

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