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:entities.County.java

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

From source file:entities.District.java

public static List queryDistrict(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.District as District");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//  w w w .j  a  va 2s  .c  om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("District", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:entities.District.java

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

From source file:entities.Division.java

public static List queryDivision(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Division as Division");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from   w  w  w .j a  va2  s  . co m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Division", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:entities.Division.java

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

From source file:entities.Group_detail.java

public static List queryGroup_detail(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Group_detail as Group_detail");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {// w w  w.  j  a  v a2 s .  c  o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Group_detail", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:entities.Group_detail.java

public static java.util.Iterator iterateGroup_detailByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Group_detail as Group_detail");
    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("Group_detail", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:entities.Group_right.java

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

From source file:entities.Group_right.java

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

From source file:entities.Group_user.java

public static List queryGroup_user(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From entities.Group_user as Group_user");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from w w  w. ja  va2 s . co  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Group_user", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}