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:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedAttributeTypeDAO.java

public static java.util.Iterator iterateLocalizedAttributeTypeByQuery(PersistentSession session,
        String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedAttributeType as LocalizedAttributeType");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*w  w w  .  j  ava 2s .com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LocalizedAttributeType", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedCommandTypeDAO.java

public static List queryLocalizedCommandType(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedCommandType as LocalizedCommandType");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*www.j av a2 s.c  o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LocalizedCommandType", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedCommandTypeDAO.java

public static java.util.Iterator iterateLocalizedCommandTypeByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedCommandType as LocalizedCommandType");
    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  . com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LocalizedCommandType", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedObjectTypeDAO.java

public static List queryLocalizedObjectType(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedObjectType as LocalizedObjectType");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   w  ww. j  av  a 2s  . c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LocalizedObjectType", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedObjectTypeDAO.java

public static java.util.Iterator iterateLocalizedObjectTypeByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.LocalizedObjectType as LocalizedObjectType");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   w  ww.  j  a  va2s.  com
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LocalizedObjectType", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.ObjectPathDAO.java

public static List queryObjectPath(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.ObjectPath as ObjectPath");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   ww w .j  a  v a 2  s .  co m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("ObjectPath", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.ObjectPathDAO.java

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

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.TrendLogDAO.java

public static List queryTrendLog(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.TrendLog as TrendLog");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from ww w .j  a  v  a 2s. c  o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("TrendLog", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.TrendLogDAO.java

public static java.util.Iterator iterateTrendLogByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.TrendLog as TrendLog");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from  w  w w  . j a v  a2 s .c o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("TrendLog", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.eefrmwrk.monitoring.tac.dao.domain.TrendLogValueDAO.java

public static List queryTrendLogValue(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.eefrmwrk.monitoring.tac.dao.domain.TrendLogValue as TrendLogValue");
    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  .  c om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("TrendLogValue", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}