Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » OptimisticLockException with delete
OptimisticLockException with delete [message #663129] Sun, 03 April 2011 21:25 Go to next message
attila Mising name is currently offline attila Mising nameFriend
Messages: 45
Registered: April 2010
Member
Hello,

Upgrading from 2.1.2 to 2.2.0 (tried with 2.3.0-M6 also) i'm facing the following issue:

Trying to issue 2 delete statements:

 this.em.createQuery("delete from whatever_entity_with_empty_table") ... ;
  this.em.createQuery("delete from annother_entity_with_empty_table") ... ;


 <property name="eclipselink.jdbc.batch-writing" value="JDBC" />
  <property name="eclipselink.jdbc.native-sql" value="true" />


using MySQL 5 as database, throws an org.eclipse.persistence.exceptions.OptimisticLockException with
Exception Description: One or more objects cannot be updated because it has changed or been deleted since it was last read

Tracing the code until the second statement is processed , the execution reaches executeBatchedStatements method in
ParameterizedSQLBatchWritingMechanism and the condition in 'if' evaluates to true as
executionCount is 0 (coming from MySQLPlatform.executeBatch ) and statementCount =1

PreparedStatement statement = this.prepareBatchStatements(session);
  executionCount += this.databaseAccessor.executeJDK12BatchStatement(statement, this.lastCallAppended, session, true);
  this.databaseAccessor.writeStatementsCount++;

  if (this.previousCall.hasOptimisticLock() && (executionCount!=statementCount)){
     throw OptimisticLockException.batchStatementExecutionFailure();
  }


I'm not really getting the point here, maybe there is something i'm missing in an upper level.
Any idea about this ?

Thank you
Re: OptimisticLockException with delete [message #663327 is a reply to message #663129] Mon, 04 April 2011 15:51 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

This is a bug,

https://bugs.eclipse.org/bugs/show_bug.cgi?id=324407

Please update this bug with your info and vote for it.

You may also wish to try the latest build, as I remember this being changed recently.

There is a workaround in the bug.


James : Wiki : Book : Blog : Twitter
Re: OptimisticLockException with delete [message #663334 is a reply to message #663327] Mon, 04 April 2011 16:29 Go to previous message
attila Mising name is currently offline attila Mising nameFriend
Messages: 45
Registered: April 2010
Member
Thank you James
Previous Topic:update query and stale cache
Next Topic:Cloning objects in EclipseLink
Goto Forum:
  


Current Time: Sat Apr 20 00:23:31 GMT 2024

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

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

Back to the top