Example usage for org.hibernate.jpa AvailableSettings LOCK_TIMEOUT

List of usage examples for org.hibernate.jpa AvailableSettings LOCK_TIMEOUT

Introduction

In this page you can find the example usage for org.hibernate.jpa AvailableSettings LOCK_TIMEOUT.

Prototype

String LOCK_TIMEOUT

To view the source code for org.hibernate.jpa AvailableSettings LOCK_TIMEOUT.

Click Source Link

Usage

From source file:de.micromata.genome.jpa.Emgr.java

License:Apache License

/**
 * Set the the query to use select for update.
 *
 * @param query the query/*w  w w  .  ja v a 2  s.c  o  m*/
 * @param lockTimetimeInMs the lock timetime in ms
 */
@Override
public void setSelectForUpdate(Query query, int lockTimetimeInMs) {
    query.setHint(AvailableSettings.LOCK_TIMEOUT, lockTimetimeInMs);
    setQueryTimeout(query, lockTimetimeInMs);
    query.setLockMode(LockModeType.PESSIMISTIC_WRITE);
}