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_de_base_de_datos.EventoDAO.java

public static java.util.Iterator iterateEventoByQuery(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 {// www .  ja va  2 s .com
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Evento", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.ImagenDAO.java

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

From source file:diagrama_de_base_de_datos.ImagenDAO.java

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

From source file:diagrama_de_base_de_datos.LineaDAO.java

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

From source file:diagrama_de_base_de_datos.LineaDAO.java

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

From source file:diagrama_de_base_de_datos.Linea_ParadaDAO.java

public static List queryLinea_Parada(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.Linea_Parada as Linea_Parada");
    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.  com
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Linea_Parada", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:diagrama_de_base_de_datos.Linea_ParadaDAO.java

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

From source file:diagrama_de_base_de_datos.ParadaDAO.java

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

From source file:diagrama_de_base_de_datos.ParadaDAO.java

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

From source file:diagrama_de_base_de_datos.PuntoInteresDAO.java

public static List queryPuntoInteres(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From diagrama_de_base_de_datos.PuntoInteres as PuntoInteres");
    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());
        query.setLockMode("PuntoInteres", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}