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:edu.mgupi.pass.db.locuses.LocusAppliedFilterParamsFactory.java

public static java.util.Iterator iterateLocusAppliedFilterParamsByQuery(PersistentSession session,
        String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedFilterParams as LocusAppliedFilterParams");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// ww  w  . j a va2s. com
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateLocusAppliedFilterParamsByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusAppliedFiltersFactory.java

public static LocusAppliedFilters[] listLocusAppliedFiltersByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedFilters as LocusAppliedFilters");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/* w ww.  ja  va  2 s .  com*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (LocusAppliedFilters[]) list.toArray(new LocusAppliedFilters[list.size()]);
    } catch (Exception e) {
        _logger.error(
                "listLocusAppliedFiltersByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusAppliedFiltersFactory.java

public static java.util.Iterator iterateLocusAppliedFiltersByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedFilters as LocusAppliedFilters");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// w w  w  .ja va 2 s .c o m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateLocusAppliedFiltersByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusAppliedModuleFactory.java

public static LocusAppliedModule[] listLocusAppliedModuleByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedModule as LocusAppliedModule");
    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("this", lockMode);
        List list = query.list();
        return (LocusAppliedModule[]) list.toArray(new LocusAppliedModule[list.size()]);
    } catch (Exception e) {
        _logger.error(
                "listLocusAppliedModuleByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusAppliedModuleFactory.java

public static java.util.Iterator iterateLocusAppliedModuleByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedModule as LocusAppliedModule");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/* w w  w  .  j av a  2s.  c om*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateLocusAppliedModuleByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusAppliedModuleParamsFactory.java

public static LocusAppliedModuleParams[] listLocusAppliedModuleParamsByQuery(PersistentSession session,
        String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedModuleParams as LocusAppliedModuleParams");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//w  w w  .  j  av a2s. co  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (LocusAppliedModuleParams[]) list.toArray(new LocusAppliedModuleParams[list.size()]);
    } catch (Exception e) {
        _logger.error(
                "listLocusAppliedModuleParamsByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusAppliedModuleParamsFactory.java

public static java.util.Iterator iterateLocusAppliedModuleParamsByQuery(PersistentSession session,
        String condition, String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From edu.mgupi.pass.db.locuses.LocusAppliedModuleParams as LocusAppliedModuleParams");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from  w  ww. jav a2 s  .  c o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error(
                "iterateLocusAppliedModuleParamsByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusesFactory.java

public static Locuses[] listLocusesByQuery(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.Locuses as Locuses");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from www  .  j  a  v a  2 s  . c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (Locuses[]) list.toArray(new Locuses[list.size()]);
    } catch (Exception e) {
        _logger.error("listLocusesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusesFactory.java

public static java.util.Iterator iterateLocusesByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.Locuses as Locuses");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*w  ww.  ja  v a  2 s . c o  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        return query.iterate();
    } catch (Exception e) {
        _logger.error("iterateLocusesByQuery(PersistentSession session, String condition, String orderBy)", e);
        throw new PersistentException(e);
    }
}

From source file:edu.mgupi.pass.db.locuses.LocusModuleDataFactory.java

public static LocusModuleData[] listLocusModuleDataByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From edu.mgupi.pass.db.locuses.LocusModuleData as LocusModuleData");
    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 om*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("this", lockMode);
        List list = query.list();
        return (LocusModuleData[]) list.toArray(new LocusModuleData[list.size()]);
    } catch (Exception e) {
        _logger.error("listLocusModuleDataByQuery(PersistentSession session, String condition, String orderBy)",
                e);
        throw new PersistentException(e);
    }
}