Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » OptimisticLockException activated batch-writing(How to get causing object)
OptimisticLockException activated batch-writing [message #1816818] Thu, 07 November 2019 15:37 Go to next message
thorsten kruse is currently offline thorsten kruseFriend
Messages: 6
Registered: October 2017
Junior Member
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 16:43 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
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 16:44]

Report message to a moderator

Re: OptimisticLockException activated batch-writing [message #1817518 is a reply to message #1817228] Mon, 25 November 2019 09:59 Go to previous message
thorsten kruse is currently offline thorsten kruseFriend
Messages: 6
Registered: October 2017
Junior Member
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 Apr 25 18:54:01 GMT 2024

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

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

Back to the top