[ https://issues.apache.org/jira/browse/OPENJPA-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg reassigned OPENJPA-2806: -------------------------------------- Assignee: Mark Struberg > 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 > 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)