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

Bug 326953

Summary: DBWS should support batch sql operations
Product: z_Archived Reporter: Mike Norman <michael.norman>
Component: EclipselinkAssignee: David McCann <david.mccann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david.mccann, eclipselink.dbws-inbox, rainer.schild
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix.
none
Supporting test cases.
none
Updated XSD files.
none
Updated XSD files (new versions) none

Description Mike Norman CLA 2010-10-04 13:48:16 EDT
<batch-sql name="get_analyzed_traces">
  <batch-text>
    <text><![CDATA[an INSERT statement]]></text>
    <text><![CDATA[another INSERT statement]]></text>
  </batch-text>
</batch-sql>

The transaction horizon would be the scope of the batch-text lines
and the response would typically only be 0/1 or true/false.
Comment 1 rainer.schild CLA 2010-10-07 08:22:53 EDT
We would like to specify sql transaction handling code in dbwsbuilder file:

Example:
START TRANSACTION;
SELECT @A:=SUM(salary) FROM table1 WHERE type=1;
UPDATE table2 SET summary=@A WHERE type=1;
COMMIT;

It should be possible to include several parameters into each single SQL statement.

Response should be 0/1 or true/false.
Comment 2 David McCann CLA 2011-06-09 16:16:17 EDT
Created attachment 197731 [details]
Proposed fix.
Comment 3 David McCann CLA 2011-06-09 16:17:11 EDT
Created attachment 197732 [details]
Supporting test cases.
Comment 4 David McCann CLA 2011-06-09 16:31:04 EDT
Reviewed by:  michael.norman@oracle.com
Tests: dbws/testing/batchsql/BatchSQLTestSuite;  all unit tests pass as expected
Revision:  9571
Comment 5 David McCann CLA 2011-06-13 11:19:38 EDT
We expect each SQL statement in the CDATA section to end with '\n'.  For example:
"<dbws-builder xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
  "<properties>" +
    "<property name=\"projectName\">batchSQL</property>" +
     ...
  "</properties>" +
  "<batch-sql " +
    "name=\"avgSalary\" " +
    ">" +
    "<batch-statement><![CDATA[" +
         "START TRANSACTION\n" +
         "SELECT @A:=AVG(SAL) FROM batch1 WHERE JOB='CLERK'\n" +
         "UPDATE batch2 SET AVGSAL=@A WHERE JOB='CLERK'\n" +
         "COMMIT\n" +
         "]]>" +
     "</batch-statement> " +
   "</batch-sql>" +
"</dbws-builder>";

We will return an instance of org.eclipse.persistence.internal.xr.ValueObject with an Integer 'value' property set to 0 (success) or 1 (failure).
Comment 6 David McCann CLA 2011-06-13 14:12:21 EDT
Created attachment 197910 [details]
Updated XSD files.
Comment 7 David McCann CLA 2011-06-23 10:23:18 EDT
Note that I will be checking in new versions of the XSD files:

- eclipselink-dbws_1.1.xsd
- eclipselink-dbws-builder_1.3.xsd
Comment 8 David McCann CLA 2011-06-23 11:42:51 EDT
Created attachment 198478 [details]
Updated XSD files (new versions)
Comment 9 David McCann CLA 2011-06-23 11:53:54 EDT
Reviewed by:  michael.norman@oracle.com
Tests: n/a
Revision: 9612
Comment 10 David McCann CLA 2011-06-23 11:56:36 EDT
Note:  commit comments indicated Bug 340723 by mistake...
Comment 11 Eclipse Webmaster CLA 2022-06-09 10:03:50 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink