Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » OptimisticLockException activated batch-writing(How to get causing object)
OptimisticLockException activated batch-writing [message #1816818] Thu, 07 November 2019 10:37 Go to next message
Eclipse UserFriend
Hello,

batch-writing is active and when an OptimisticLockException appears the message says "One or more objects cannot be updated because it has changed or been deleted since it was last read". Is there a way to get the object or the SQL statement as you get it when batch-writing is not active?

Regards, Thorsten
Re: OptimisticLockException activated batch-writing [message #1817228 is a reply to message #1816818] Mon, 18 November 2019 11:43 Go to previous messageGo to next message
Eclipse UserFriend
EclipseLink does not have support for getting the object, but the SQL itself is logged so you could add support for getting the set of parameters involved with the failure with a bit of digging. I would guess this is platform dependent though, as Oracle classes have their own slightly different behaviour where the OracleStatement sendBatch only returns the row count.

The org.eclipse.persistence.internal.databaseaccess.DatabasePlatform executeBatch method returns a single int, but could return the int[] from the driver. This could then be used within the calling org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism executeBatch method which has an array of parameters used in the batch that would line up with the int[] results. You would need to go through the count to find one that returned 0, and match it up to the entry in the parameter list to get the first set that would cause an optimistic lock exception, and then throw the error appropriately.

Best Regards,
Chris

[Updated on: Mon, 18 November 2019 11:44] by Moderator

Re: OptimisticLockException activated batch-writing [message #1817518 is a reply to message #1817228] Mon, 25 November 2019 04:59 Go to previous message
Eclipse UserFriend
Hello Chris,

thanks a lot for your answer. Sounds to me like the API has to be changed. I am no commiter just a eclipselink *user*. If I would like to have this feature I have to open a bug with importance "enhancement" to bugzilla . Is it the right way?

Regards, Thorsten
Previous Topic:StackOverflowError Ending in DatabaseField.equals
Next Topic:npe while unmarshal date field as json array
Goto Forum:
  


Current Time: Thu May 15 18:35:52 EDT 2025

Powered by FUDForum. Page generated in 0.03546 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top