Example usage for org.hibernate Criteria setLockMode

List of usage examples for org.hibernate Criteria setLockMode

Introduction

In this page you can find the example usage for org.hibernate Criteria setLockMode.

Prototype

public Criteria setLockMode(LockMode lockMode);

Source Link

Document

Set the lock mode of the current entity.

Usage

From source file:org.kaaproject.kaa.server.common.dao.impl.sql.HibernateAbstractDao.java

License:Apache License

protected T findOneByCriterionWithLock(Criterion criterion, LockMode lockMode) {
    String className = getSimpleClassName();
    LOG.trace("Searching {} entity by criterion [{}] ", className, criterion);
    Criteria criteria = getCriteria();
    criteria.setLockMode(lockMode);
    criteria.add(criterion);/*  w w w  . ja  va  2 s.  c  om*/
    return (T) criteria.uniqueResult();
}