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.distribution.resource.FinancialResourceDAO.java

public static List queryFinancialResource(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.FinancialResource as FinancialResource");
    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("FinancialResource", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.distribution.resource.FinancialResourceDAO.java

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

From source file:businesslogic.distribution.resource.HumanResourceDAO.java

public static List queryHumanResource(PersistentSession session, String condition, String orderBy,
        org.hibernate.LockMode lockMode) throws PersistentException {
    StringBuffer sb = new StringBuffer(
            "From businesslogic.distribution.resource.HumanResource as HumanResource");
    if (condition != null)
        sb.append(" Where ").append(condition);
    if (orderBy != null)
        sb.append(" Order By ").append(orderBy);
    try {//from www  .ja v a  2  s  .  c om
        Query query = session.createQuery(sb.toString());
        query.setLockMode("HumanResource", lockMode);
        return query.list();
    } catch (Exception e) {
        e.printStackTrace();
        throw new PersistentException(e);
    }
}

From source file:businesslogic.distribution.resource.HumanResourceDAO.java

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

From source file:businesslogic.distribution.resource.InformationResourceDAO.java

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

From source file:businesslogic.distribution.resource.InformationResourceDAO.java

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

From source file:businesslogic.distribution.resource.ModuleChangeDAO.java

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

From source file:businesslogic.distribution.resource.ModuleChangeDAO.java

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

From source file:businesslogic.distribution.resource.ModuleDAO.java

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

From source file:businesslogic.distribution.resource.ModuleDAO.java

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