Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320643 - org.eclipse.persistence.exceptions.OptimisticLockException vs javax.persistence.OptimisticLockException
Summary: org.eclipse.persistence.exceptions.OptimisticLockException vs javax.persisten...
Status: RESOLVED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 320401 337291
Blocks: 340785 320413
  Show dependency tree
 
Reported: 2010-07-22 10:44 EDT by Adrian Goerler CLA
Modified: 2022-06-09 10:24 EDT (History)
6 users (show)

See Also:


Attachments
proposed patch (3.02 KB, patch)
2010-07-22 10:47 EDT, Adrian Goerler CLA
no flags Details | Diff
proposed patch and regression test (48.54 KB, patch)
2010-07-23 08:30 EDT, Adrian Goerler CLA
no flags Details | Diff
proposed patch and regression test (53.11 KB, patch)
2010-09-20 09:17 EDT, Adrian Goerler CLA
no flags Details | Diff
proposed patch enabling the regression test TestOptimistic (38.07 KB, patch)
2011-02-17 12:47 EST, Adrian Goerler CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Goerler CLA 2010-07-22 10:44:39 EDT
If I enable JDBC batching, in case of an optimistic comparison failure a RollbackException (upon commit) or PersistenceException (upon flush) is thrown, which has an org.eclipse.persistence.exceptions.OptimisticLockException as its cause. A javax.persistence.OptimisticLockException would be expected instead.

If I disable JDBC batching, the cause is a javax.persistence.OptimisticLockException as expected.
Comment 1 Adrian Goerler CLA 2010-07-22 10:47:56 EDT
Created attachment 174988 [details]
proposed patch
Comment 2 Adrian Goerler CLA 2010-07-23 08:30:29 EDT
Created attachment 175059 [details]
proposed patch and regression test

This patch now takes into account that the commitToDatabase method is also invoked from flush.

The patch now contains regression tests TestOptimistic for OLEs upon

- commit
- flush
- query (implicit flush)

The tests are executed with and without batching.
Comment 3 Adrian Goerler CLA 2010-09-20 09:17:23 EDT
Created attachment 179243 [details]
proposed patch and regression test

Updated and resolved on 2010/09/20.
Comment 4 Adrian Goerler CLA 2011-02-17 12:47:19 EST
Created attachment 189210 [details]
proposed patch enabling the regression test TestOptimistic
Comment 5 Adrian Goerler CLA 2011-02-17 12:53:09 EST
Reviewed by Michael O'Brien
Tested on MySQL, MaxDB
Checked in at 8981.
Comment 6 Adrian Goerler CLA 2011-02-17 12:55:36 EST
The patch could be further refactored in order to move the translation of EclipseLink OLEs to JPA OLEs from core to the JPA component. This is a bit of a challenge as JTA commits the UOW bypassing the JPA layer.
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:24:34 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink