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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public static List queryLocalizedAttributeType(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 {/*from  ww  w  . j a  v a  2s  .  c  o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("LocalizedAttributeType", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}