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

public static java.util.Iterator iterateTrendLogValueByQuery(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 {/*  www .jav  a  2  s . c om*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("TrendLogValue", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_answerDAOImpl.java

License:Open Source License

public List queryKtek_answer(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From es.tekniker.framework.ktek.Ktek_answer as Ktek_answer");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// w w  w. jav a 2 s .  co m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_answer", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error("listKtek_answerByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_answerDAOImpl.java

License:Open Source License

public java.util.Iterator iterateKtek_answerByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From es.tekniker.framework.ktek.Ktek_answer as Ktek_answer");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  w w  w .ja  v a2s .  c o m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_answer", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateKtek_answerByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_answersetDAOImpl.java

License:Open Source License

public List queryKtek_answerset(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From es.tekniker.framework.ktek.Ktek_answerset as Ktek_answerset");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/* w  ww  .  jav a  2  s  .  co m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_answerset", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error("listKtek_answersetByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_answersetDAOImpl.java

License:Open Source License

public java.util.Iterator iterateKtek_answersetByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From es.tekniker.framework.ktek.Ktek_answerset as Ktek_answerset");
    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.com
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_answerset", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateKtek_answersetByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_auditaccesslogDAOImpl.java

License:Open Source License

public List queryKtek_auditaccesslog(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.framework.ktek.Ktek_auditaccesslog as Ktek_auditaccesslog");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  ww w  .  ja  v  a  2  s  . co m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_auditaccesslog", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listKtek_auditaccesslogByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_auditaccesslogDAOImpl.java

License:Open Source License

public java.util.Iterator iterateKtek_auditaccesslogByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.framework.ktek.Ktek_auditaccesslog as Ktek_auditaccesslog");
    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 o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_auditaccesslog", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateKtek_auditaccesslogByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_codificationDAOImpl.java

License:Open Source License

public List queryKtek_codification(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.framework.ktek.Ktek_codification as Ktek_codification");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from w w w.ja  va2s  .  c o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_codification", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listKtek_codificationByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_codificationDAOImpl.java

License:Open Source License

public java.util.Iterator iterateKtek_codificationByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.framework.ktek.Ktek_codification as Ktek_codification");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// www  .j a  v a 2 s . c om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_codification", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateKtek_codificationByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:es.tekniker.framework.ktek.impl.Ktek_formatquestionnaireDAOImpl.java

License:Open Source License

public List queryKtek_formatquestionnaire(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From es.tekniker.framework.ktek.Ktek_formatquestionnaire as Ktek_formatquestionnaire");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   ww  w .  ja v a 2  s . c  o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Ktek_formatquestionnaire", lockMode);
        return query.list();
    } catch (Exception e) {
        _logger.error(
                "listKtek_formatquestionnaireByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}