use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class PostgreSQL81DialectTestCase method testGetForUpdateStringWithAliasesAndLockOptions.
/**
* Tests that getForUpdateString(String aliases, LockOptions lockOptions) will return a String
* that will effect the SELECT ... FOR UPDATE OF tableAlias1, ..., tableAliasN
*/
@TestForIssue(jiraKey = "HHH-5654")
public void testGetForUpdateStringWithAliasesAndLockOptions() {
PostgreSQL81Dialect dialect = new PostgreSQL81Dialect();
LockOptions lockOptions = new LockOptions();
lockOptions.setAliasSpecificLockMode("tableAlias1", LockMode.PESSIMISTIC_WRITE);
String forUpdateClause = dialect.getForUpdateString("tableAlias1", lockOptions);
assertTrue("for update of tableAlias1".equals(forUpdateClause));
lockOptions.setAliasSpecificLockMode("tableAlias2", LockMode.PESSIMISTIC_WRITE);
forUpdateClause = dialect.getForUpdateString("tableAlias1,tableAlias2", lockOptions);
assertTrue("for update of tableAlias1,tableAlias2".equals(forUpdateClause));
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class SQLServer2005DialectTestCase method testAppendLockHintUpgradeNoWait.
@Test
@TestForIssue(jiraKey = "HHH-9635")
public void testAppendLockHintUpgradeNoWait() {
final String expectedLockHint = "tab1 with (updlock, rowlock, nowait)";
LockOptions lockOptions = new LockOptions(LockMode.UPGRADE_NOWAIT);
String lockHint = dialect.appendLockHint(lockOptions, "tab1");
assertEquals(expectedLockHint, lockHint);
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class SQLServer2005DialectTestCase method testAppendLockHintWriteWithNoTimeOut.
@Test
@TestForIssue(jiraKey = "HHH-9635")
public void testAppendLockHintWriteWithNoTimeOut() {
final String expectedLockHint = "tab1 with (updlock, rowlock, nowait)";
LockOptions lockOptions = new LockOptions(LockMode.WRITE);
lockOptions.setTimeOut(LockOptions.NO_WAIT);
String lockHint = dialect.appendLockHint(lockOptions, "tab1");
assertEquals(expectedLockHint, lockHint);
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class SQLServer2005DialectTestCase method testAppendLockHintPessimisticRead.
@Test
@TestForIssue(jiraKey = "HHH-9635")
public void testAppendLockHintPessimisticRead() {
final String expectedLockHint = "tab1 with (holdlock, rowlock)";
LockOptions lockOptions = new LockOptions(LockMode.PESSIMISTIC_READ);
String lockHint = dialect.appendLockHint(lockOptions, "tab1");
assertEquals(expectedLockHint, lockHint);
}
use of org.hibernate.LockOptions in project hibernate-orm by hibernate.
the class SQLServer2005DialectTestCase method testAppendLockHintReadPastLocking.
@Test
@TestForIssue(jiraKey = "HHH-9635")
public void testAppendLockHintReadPastLocking() {
final String expectedLockHint = "tab1 with (updlock, rowlock, readpast)";
LockOptions lockOptions = new LockOptions(LockMode.UPGRADE_SKIPLOCKED);
String lockHint = dialect.appendLockHint(lockOptions, "tab1");
assertEquals(expectedLockHint, lockHint);
}
Aggregations