Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop EJB applications > Develop applications that use the Java Persistence API


SQL statement batching for JPA applications

SQL statement batching can improve the performance of your application server.

Attention: Support for SQL statement batching is no longer a WAS for JPA extension. We can find information regarding statement batching in the Apache OpenJPA documentation.

By default, statement batching is enabled for DB2 and Oracle databases.

To enable SQL statement batching and to set the batch limit for JPA applications, configure the persistence.xml file. The following steps review how to enable and disable statement batching, and set the batch limit:


Procedure

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

    The example shows that the SQL statement batch limit is set to 100.

    Remember: If you are using a DB2 or an Oracle database, by default the SQL statement batching is enabled and set to batchLimit=100. However, if you are using DB2 or Oracle, you are not required to specify this property in the persistence.xml file.

  2. If disable SQL statement batching, set the batchLimit value to 0 or remove the property. However, if you are using a DB2 or an Oracle database, specify the DBDictionary property, database, and set the defaultBatchLimit to 0 . For example:
    <property name="openjpa.jdbc.DBDictionary" value="db2(defaultBatchLimit=0)"/> 


Results

You have now updated the persistence.xml file to enable or disable statement batching and set the batch limit.
Associate persistence providers and data sources
Apache OpenJPA User Guide: Statement Batching

+

Search Tips   |   Advanced Search