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:businesslogic.accounting.job.UserJobDAO.java

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

From source file:businesslogic.accounting.job.UserJobDAO.java

public static java.util.Iterator iterateUserJobByQuery(PersistentSession session, String condition,
        String orderBy, org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.job.UserJob as UserJob");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*from w  w w.j ava2  s  .  c o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("UserJob", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.job.UserPermissionDAO.java

public static List queryUserPermission(PersistentSession session, String condition, String orderBy,
        LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.job.UserPermission as UserPermission");
    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 .  c  o m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("UserPermission", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.job.UserPermissionDAO.java

public static java.util.Iterator iterateUserPermissionByQuery(PersistentSession session, String condition,
        String orderBy, LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.job.UserPermission as UserPermission");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//w  ww . j a  va 2  s .c o  m
        Query query = session.createQuery(sb.toString());
        query.setLockMode("UserPermission", lockMode);
        return query.iterate();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.user.AdminDAO.java

public static List queryAdmin(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.user.Admin as Admin");
    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.c o m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Admin", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.user.AdminDAO.java

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

From source file:businesslogic.accounting.user.EmployeeDAO.java

public static List queryEmployee(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer("From businesslogic.accounting.user.Employee as Employee");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {/*  w w  w.jav a2s.co  m*/
        Query query = session.createQuery(sb.toString());
        query.setLockMode("Employee", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.accounting.user.EmployeeDAO.java

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

From source file:businesslogic.accounting.user.HighLevelManagerDAO.java

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

From source file:businesslogic.accounting.user.HighLevelManagerDAO.java

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