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:foundation.ESottoprogettoDAO.java

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

From source file:foundation.ESpesaExtraDAO.java

public static ESpesaExtra[] listESpesaExtraByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ESpesaExtra as ESpesaExtra");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   ww w  .j  ava2s  .com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (ESpesaExtra[]) list.toArray(new ESpesaExtra[list.size()]);
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:foundation.ESpesaExtraDAO.java

public static java.util.Iterator iterateESpesaExtraByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ESpesaExtra as ESpesaExtra");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from   w  ww. ja  va2s . co m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:foundation.ETariffaDAO.java

public static ETariffa[] listETariffaByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ETariffa as ETariffa");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   w  w w .jav a 2s  .  c  o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (ETariffa[]) list.toArray(new ETariffa[list.size()]);
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:foundation.ETariffaDAO.java

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

From source file:foundation.ETaskDAO.java

public static ETask[] listETaskByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ETask as ETask");
    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.c  o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (ETask[]) list.toArray(new ETask[list.size()]);
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:foundation.ETaskDAO.java

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

From source file:foundation.ETimeRecordLavorativoDAO.java

public static ETimeRecordLavorativo[] listETimeRecordLavorativoByQuery(PersistentSession session,
        String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ETimeRecordLavorativo as ETimeRecordLavorativo");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//ww w . ja  v  a  2s . c  o m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (ETimeRecordLavorativo[]) list.toArray(new ETimeRecordLavorativo[list.size()]);
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:foundation.ETimeRecordLavorativoDAO.java

public static java.util.Iterator iterateETimeRecordLavorativoByQuery(PersistentSession session,
        String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ETimeRecordLavorativo as ETimeRecordLavorativo");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from  w  w  w  . java2 s .  co  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:foundation.ETimeRecordNLDAO.java

public static ETimeRecordNL[] listETimeRecordNLByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From foundation.ETimeRecordNL as ETimeRecordNL");
    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  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (ETimeRecordNL[]) list.toArray(new ETimeRecordNL[list.size()]);
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}