You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Mark Struberg (Jira)" <ji...@apache.org> on 2021/04/07 05:43:00 UTC
[jira] [Updated] (OPENJPA-2806) PESSIMISTIC_READ takes out
exclusive lock on Postgres
[ https://issues.apache.org/jira/browse/OPENJPA-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg updated OPENJPA-2806:
-----------------------------------
Fix Version/s: 3.1.3
> 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: 2.4.2, 3.0.0, 3.1.0
> Reporter: Pawel Veselov
> Assignee: Mark Struberg
> Priority: Major
> Fix For: 3.1.3
>
> Attachments: openjpa-lock.zip
>
>
> 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 taken by OpenJPA is exclusive, then native query will fail (with an exception).
> I'm testing on Postgres 9.6
> Tested with 2.4.2, 3.0.0 and 3.1.0
--
This message was sent by Atlassian Jira
(v8.3.4#803005)