Configuring heterogeneous SQL statement batching

Heterogeneous SQL statement batching is an improvement over the org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager. This functionality can improve the performance of your JPA application because it allows multiple different SQL statements to be sent to the database in a single batch. For example, if you have a transaction that updates one Entity and also inserts another Entity, when you use the BatchingConstraintUpdateManager function, two different batches are sent to the database: one for the update and another for the insert. In the same scenario, if you use the HeteroConstraintUpdateManager function, only one batch, which contains both operations, is sent to the database.

About this task

Note: This configuration is for use with a Java™ Persistence API (JPA) 2.0 specification provider, WSJPA or OpenJPA.
To enable the heterogeneous SQL statement batching function, you must:
  • Be using DB2.
  • Have entitlement to the IBM Optim pureQuery Runtime.
  • Have the pdqmgmt.jar file included on your datasource classpath.

Procedure

Define the UpdateManager property in the persistence.xml file
For example:
<property name="openjpa.jdbc.UpdateManager" 
   value="com.ibm.ws.persistence.jdbc.kernel.HeteroConstraintUpdateManager(batchLimit=250)"/>

In this example the SQL statement batch limit is set to 250.

The default batch limit is 100.

Results

You have now updated the persistence.xml file to enable heterogeneous statement batching.

Icon that indicates the type of topic Task topic



Timestamp icon Last updated: March 5, 2017 17:27
File name: tejb_configjpa_hetsql.html