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:eu.epichub.gateway.eg.core.impl.gateway_driverDAOImpl.java

public java.util.Iterator iterateGateway_driverByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_driver as gateway_driver");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  www  .j  av a2 s .c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_driver", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateGateway_driverByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_hostDAOImpl.java

public List queryGateway_host(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_host as gateway_host");
    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 . co m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_host", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error("listGateway_hostByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_hostDAOImpl.java

public java.util.Iterator iterateGateway_hostByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_host as gateway_host");
    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 2s  .c  o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_host", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateGateway_hostByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_locationDAOImpl.java

public List queryGateway_location(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_location as gateway_location");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   ww  w . j av  a 2  s.c  o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_location", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listGateway_locationByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_locationDAOImpl.java

public java.util.Iterator iterateGateway_locationByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_location as gateway_location");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*ww  w  .j  ava  2  s.  c o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_location", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateGateway_locationByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_setpointDAOImpl.java

public List queryGateway_setpoint(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_setpoint as gateway_setpoint");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  ww  w . j  a va  2s  . c  o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_setpoint", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listGateway_setpointByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_setpointDAOImpl.java

public java.util.Iterator iterateGateway_setpointByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From eu.epichub.gateway.eg.core.gateway_setpoint as gateway_setpoint");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//  w w w. j  a  v  a2s.c  o m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_setpoint", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateGateway_setpointByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_subscriberDAOImpl.java

public List queryGateway_subscriber(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From eu.epichub.gateway.eg.core.gateway_subscriber as gateway_subscriber");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/* www . j a v a 2s . com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_subscriber", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listGateway_subscriberByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_subscriberDAOImpl.java

public java.util.Iterator iterateGateway_subscriberByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From eu.epichub.gateway.eg.core.gateway_subscriber as gateway_subscriber");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from w  w w.j  a va2s.  co  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("gateway_subscriber", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateGateway_subscriberByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:eu.epichub.gateway.eg.core.impl.gateway_subscriptionDAOImpl.java

public List queryGateway_subscription(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From eu.epichub.gateway.eg.core.gateway_subscription as gateway_subscription");
    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());
        query.setLockMode("gateway_subscription", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listGateway_subscriptionByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}