Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320401

Summary: Batching of UPDATE statements on MaxDB
Product: z_Archived Reporter: Adrian Goerler <adrian.goerler>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: andreas.fischbach, eclipselink.incubator-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: MaxDB
Bug Depends on:    
Bug Blocks: 284657, 320643    
Attachments:
Description Flags
patch for this issue
none
patch allowing to batch Statements as well none

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