You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Pawel Veselov (Jira)" <ji...@apache.org> on 2020/02/25 18:44:00 UTC

[jira] [Created] (OPENJPA-2806) PESSIMISTIC_READ takes out exclusive lock on Postgres

Pawel Veselov created OPENJPA-2806:
--------------------------------------

             Summary: PESSIMISTIC_READ takes out exclusive lock on Postgres
                 Key: OPENJPA-2806
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2806
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 3.1.0, 3.0.0, 2.4.2
            Reporter: Pawel Veselov


I've found out that using PESSIMISTIC_READ on an entity with postgres
uses 'for update' lock, which is actually exclusive.

I understand JPA specification says that it's permissible to do that,
but I really need a shared lock for what I'm trying to achieve.

Is it possible to control somehow? I've had to resolve to using native
queries, and I'd like to avoid this as much as possible...

Attached is a test.
Change App.java to control database properties for connection (top of `main()`)
Run App.class to execute the test. If the lock is shared, then native query will fail.
I'm testing on Postgres 9.6



--
This message was sent by Atlassian Jira
(v8.3.4#803005)