+

Search Tips   |   Advanced Search

Configure 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 our 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 using 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 we use the HeteroConstraintUpdateManager function, only one batch, which contains both operations, is sent to the database.

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, we must:


Tasks

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.

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

  • Configure JPA to work in the environment