We're updating the issue view to help you get more done. 

PostgreSQL81Dialect does not honor the lock timeout settings

Description

When executing an entity query and providing a lock timeout setting:

1 2 3 4 5 6 7 8 9 List<Post> _pendingPosts = _entityManager.createQuery( "select p " + "from Post p " + "where p.status = :status", Post.class) .setParameter("status", PostStatus.PENDING) .setMaxResults(10) .unwrap(org.hibernate.Query.class) .setLockOptions(new LockOptions(LockMode.PESSIMISTIC_WRITE).setTimeOut(LockOptions.NO_WAIT) ) .list();

The Postgres Dialect simply ignores the NOWAIT clause:

1 2 3 4 5 6 7 8 9 SELECT p.id AS id1_0_ , p.body AS body2_0_ , p.status AS status3_0_ , p.title AS title4_0_ , p.version AS version5_0_ FROM post p WHERE p.status = 0 LIMIT 10 FOR UPDATE of p

This happens because the public String getForUpdateString(String aliases, LockOptions lockOptions) method implementation calls return getForUpdateString( aliases ); instead of return getForUpdateString(String aliases, LockOptions lockOptions);

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Vlad Mihalcea

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Priority

Major