Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320401 - Batching of UPDATE statements on MaxDB
Summary: Batching of UPDATE statements on MaxDB
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard: MaxDB
Keywords:
Depends on:
Blocks: 284657 320643
  Show dependency tree
 
Reported: 2010-07-20 10:54 EDT by Adrian Goerler CLA
Modified: 2022-06-09 10:25 EDT (History)
2 users (show)

See Also:


Attachments
patch for this issue (8.83 KB, patch)
2010-07-20 11:49 EDT, Adrian Goerler CLA
no flags Details | Diff
patch allowing to batch Statements as well (608 bytes, patch)
2010-07-23 08:22 EDT, Adrian Goerler CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Goerler CLA 2010-07-20 10:54:09 EDT
On SAP MaxDB, batching of UPDATE statements is not yet supported.

To allow for optimistic verifications, EclipseLink compares the expected value of the version attribute with the value present on the database using an additional condition in the where-clause.

Using the property 

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

EclipseLink can be advised to batch INSERT and UPDATE statements using a prepared statement batch. To detect optimistic verfification failures, EclipseLink has to distinguish wether a row has been updated sucessfully or whether a row was not found by the WHERE condition. Therefore, for every element in the batch, it needs to know whether a row has been changed or not.

The PreparedStatement.executeBatch method returns an int[], which contains the number of changed rows. Unfortunately, JDBC also alows to return a general sucess indicator Statement.SUCCESS_NO_INFO, which does not allow the distnction between 1 row changed and no row changed. On MaxDB only SUCCESS_NO_INFO is returned.

Fortunately, MaxDB allows to determine the total number of rows changed using the Statement.getUpdateCount method. This method could be leveraged to enable batching of UPDATE statements on MaxDB.
Comment 1 Adrian Goerler CLA 2010-07-20 11:49:39 EDT
Created attachment 174758 [details]
patch for this issue
Comment 2 Adrian Goerler CLA 2010-07-20 12:00:15 EDT
Checked in in incubator at #7876.
Comment 3 Adrian Goerler CLA 2010-07-23 08:21:32 EDT
Patch does not work with heterogenous non-parameterized Statement batches.
Comment 4 Adrian Goerler CLA 2010-07-23 08:22:02 EDT
Created attachment 175058 [details]
patch allowing to batch Statements as well
Comment 5 Adrian Goerler CLA 2010-07-23 08:25:06 EDT
Checked in at rev #7906.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:25:46 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink