use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class HANALockTimeoutTest method testLockTimeoutNoAliasSkipLocked.
@Test
public void testLockTimeoutNoAliasSkipLocked() {
assertEquals(" for update", dialect.getForUpdateString(new LockOptions(LockMode.PESSIMISTIC_READ).setTimeOut(LockOptions.SKIP_LOCKED)));
assertEquals(" for update", dialect.getForUpdateString(new LockOptions(LockMode.PESSIMISTIC_WRITE).setTimeOut(LockOptions.SKIP_LOCKED)));
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class OracleLockTimeoutTest method testLockTimeoutNoAliasNoWait.
@Test
public void testLockTimeoutNoAliasNoWait() {
assertEquals(" for update nowait", dialect.getForUpdateString(new LockOptions(LockMode.PESSIMISTIC_READ).setTimeOut(LockOptions.NO_WAIT)));
assertEquals(" for update nowait", dialect.getForUpdateString(new LockOptions(LockMode.PESSIMISTIC_WRITE).setTimeOut(LockOptions.NO_WAIT)));
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class PostgreSQLLockTimeoutTest method testLockTimeoutNoAliasNoWait.
@Test
public void testLockTimeoutNoAliasNoWait() {
assertEquals(" for share nowait", dialect.getForUpdateString(new LockOptions(LockMode.PESSIMISTIC_READ).setTimeOut(LockOptions.NO_WAIT)));
assertEquals(" for update nowait", dialect.getForUpdateString(new LockOptions(LockMode.PESSIMISTIC_WRITE).setTimeOut(LockOptions.NO_WAIT)));
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class OracleFollowOnLockingTest method testPessimisticLockWithMaxResultsThenNoFollowOnLocking.
@Test
public void testPessimisticLockWithMaxResultsThenNoFollowOnLocking() {
final Session session = openSession();
session.beginTransaction();
sqlStatementInterceptor.getSqlQueries().clear();
List<Product> products = session.createQuery("select p from Product p", Product.class).setLockOptions(new LockOptions(LockMode.PESSIMISTIC_WRITE)).setMaxResults(10).getResultList();
assertEquals(10, products.size());
assertEquals(1, sqlStatementInterceptor.getSqlQueries().size());
session.getTransaction().commit();
session.close();
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class OracleFollowOnLockingTest method testPessimisticLockWithUnionThenFollowOnLocking.
@Test
public void testPessimisticLockWithUnionThenFollowOnLocking() {
final Session session = openSession();
session.beginTransaction();
sqlStatementInterceptor.getSqlQueries().clear();
List<Vehicle> vehicles = session.createQuery("select v from Vehicle v").setLockOptions(new LockOptions(LockMode.PESSIMISTIC_WRITE)).getResultList();
assertEquals(3, vehicles.size());
assertEquals(4, sqlStatementInterceptor.getSqlQueries().size());
session.getTransaction().commit();
session.close();
}
Aggregations