mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
HHH-2735 - Added test cases.
This commit is contained in:
parent
7ae3e1c3b7
commit
bd49676cb6
@ -136,6 +136,30 @@ public void testQueryUsingLockOptions() {
|
||||
} );
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-2735")
|
||||
public void testQueryLockModeNoneWithAlias() {
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
// shouldn't throw an exception
|
||||
session.createQuery( "SELECT a.value FROM A a where a.id = :id" )
|
||||
.setLockMode( "a", LockMode.NONE )
|
||||
.setParameter( "id", 1L )
|
||||
.list();
|
||||
} );
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-2735")
|
||||
public void testQueryLockModePessimisticWriteWithAlias() {
|
||||
doInHibernate( this::sessionFactory, session -> {
|
||||
// shouldn't throw an exception
|
||||
session.createQuery( "SELECT MAX(a.id)+1 FROM A a where a.value = :value" )
|
||||
.setLockMode( "a", LockMode.PESSIMISTIC_WRITE )
|
||||
.setParameter( "value", "it" )
|
||||
.list();
|
||||
} );
|
||||
}
|
||||
|
||||
private void nowAttemptToUpdateRow() {
|
||||
// here we just need to open a new connection (database session and transaction) and make sure that
|
||||
// we are not allowed to acquire exclusive locks to that row and/or write to that row. That may take
|
||||
|
Loading…
x
Reference in New Issue
Block a user