Tune applications that use the Java Persistence API
Subtopics
- JPA system properties
In addition to the settings that are accessible from the administrative console, we can set Java Persistence API (JPA) system properties using command-line scripting.- 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.- Configure WSJPA ObjectCache to improve performance
The WebSphere Java Persistence API (WSJPA) extension to OpenJPA provides a read-only object cache that can improve performance in certain use cases. This configuration is only supported when we use WSJPA at the JPA 2.0 specification level.- Pre-loading the WSJPA ObjectCache automatically
The WebSphere Java Persistence API (WSJPA) extension to OpenJPA provides a read-only ObjectCache that can improve performance in certain use cases. By default, the data in the cache is loaded in a lazy method, which means that individual entities are loaded into memory when they are requested by an application. To load all the entities from the beginning, though, we can configure the application server to preload all of the entities from the database configured in the ObjectCache. Pre-loading the ObjectCache will allow us to cache entities that would otherwise be restricted when if you load the ObjectCache through the lazy method. This configuration is only supported when we use WSJPA at the JPA 2.0 specification level.- JPA system properties
In addition to the settings that are accessible from the administrative console, we can set Java Persistence API (JPA) system properties using command-line scripting.- 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.- Configure WSJPA ObjectCache to improve performance
The WebSphere Java Persistence API (WSJPA) extension to OpenJPA provides a read-only object cache that can improve performance in certain use cases. This configuration is only supported when we use WSJPA at the JPA 2.0 specification level.- Pre-loading the WSJPA ObjectCache automatically
The WebSphere Java Persistence API (WSJPA) extension to OpenJPA provides a read-only ObjectCache that can improve performance in certain use cases. By default, the data in the cache is loaded in a lazy method, which means that individual entities are loaded into memory when they are requested by an application. To load all the entities from the beginning, though, we can configure the application server to preload all of the entities from the database configured in the ObjectCache. Pre-loading the ObjectCache will allow us to cache entities that would otherwise be restricted when if you load the ObjectCache through the lazy method. This configuration is only supported when we use WSJPA at the JPA 2.0 specification level.