Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320643

Summary: org.eclipse.persistence.exceptions.OptimisticLockException vs javax.persistence.OptimisticLockException
Product: z_Archived Reporter: Adrian Goerler <adrian.goerler>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: adrian.goerler, Bernhard.Riedhofer, eclipselink.orm-inbox, gordon.yorke, michael.f.obrien, sabine.heider
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 320401, 337291    
Bug Blocks: 340785, 320413    
Attachments:
Description Flags
proposed patch
none
proposed patch and regression test
none
proposed patch and regression test
none
proposed patch enabling the regression test TestOptimistic none

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