Community
Participate
Working Groups
Build Identifier: 2.1.1.v20100817-r8050 Investigation shows that there seems to be an inconsistency in how EclipseLink in ParameterizedSQLBatchWritingMechanism computes the number of entities that should be affected by a "batch" query and the number that is returned by the Oracle specific implementation of DatabasePlatform.executeBatch() Furthermore we notice that of all DatabasePlatform implementations Oracle10Platform is the only one that overrides canBatchWriteWithOptimisticLocking() to return true. Workaround: - Either: override Oracle10Platform.canBatchWriteWithOptimisticLocking() to return always false - Or: (less invasive, but switching off all batch writing) set eclipselink.jdbc.batch-writing to NONE Notes: - Our code works fine with many other database backends, e.g. H2, DB2, Postgresql, MS SQL Reproducible: Always Steps to Reproduce: Steps to reproduce: - Use Oracle 10 or 11 as backend with the Oracle10Platform - OptimisticLocking should be active (by default?) - eclipselink.jdbc.batch-writing is set to JDBC or Oracle-JDBC - Execute a JPA Query that deletes multiple rows, e.g. DELETE FROM MyEntityClass AS c WHERE c.id IN (1, 2, 3, ...) with the Query.executeUpdate() method Result: - OptimisticLockException is thrown in ParameterizedSQLBatchWritingMechanism.executeBatchedStatements() with exception description: "One or more objects cannot be updated because it has changed or been deleted since it was last read"
Setting target and priority. See the following page for details of the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Moving this bug into 2.4 based on the effect I have seen at a customer site. Depending on the complexity of the fix we may want to port to 2.2/2.3 patches.
Created attachment 215662 [details] Suggested patch. It is impossible to enforce optimistic lock for bulk delete, don't set hasOptimisticLock to true.
Checked the fix into both trunk 2.4 (revision: 11371) and 2.3.3 (revision: 11372)
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink