You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Rahul Sethi (JIRA)" <ji...@apache.org> on 2010/02/16 08:20:27 UTC

[jira] Created: (OPENJPA-1513) Backward compatibility issue with version 1.2.1: Optimistic Lock exception is thrown when select is run on an updated object

Backward compatibility issue with version 1.2.1: Optimistic Lock exception is thrown when select is run on an updated object
----------------------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-1513
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1513
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.2.1
         Environment: Windows XP, Java 1.5
            Reporter: Rahul Sethi


I have found the following use case in which the optimistic lock exception is always thrown.

The complete scenario is running in a single transaction.
Entities involved:
class A { int property1; }
class B {Map<Long, A> map; }

UseCase:
1) Update property1 of two entity A objects A1 and A2.
2) Add A1 and A2 to an existing entity B object B1.
3) Run a select query for A1 and A2.

Result:
Step 3) doesn't run and an Optimistic Lock Exception is thrown.

Debug results:
In the MySQL query log, i figured out that the update ran instantaneously for A1 but not for A2. And when step 3) was executed, Optimistic Lock Exception came up in logs, and the update query for A2 was shown in the MySQL logs.

Observations:
1) The above use case ran fine if the update was done to single A object instead of two.
2) This use case ran fine in the 1.0.1 version of Openjpa.

Possible cause:
1) I feel that this is happening because openjpa is caching some update queries for optimization.

Is this a bug in openjpa or i need to change my code/configurations?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.