(V8502)Configure heterogeneous SQL statement batching for JPA applications
Heterogeneous SQL statement batching is an improvement over the org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager. This functionality can improve the performance of the JPA application because it allows multiple different SQL statements to be sent to the database in a single batch. For example, if we 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.
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 the datasource classpath.
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.
Related tasks
Configure JPA to work in the environment