Liberty Repository[8.5.5.6 or later]
This topic applies to WebSphere Application Server Liberty V8.5.5.9 and earlier. For the latest Liberty topics, see the WebSphere Application Server Liberty documentation.

Java batch persistence configuration

Java batch uses a persistent store to persist status, checkpoints, and application persistent data across multiple runs of a job instance. The persistent store enables a job instance to be restarted if an earlier run fails or must be stopped by supplying the restarted job with the appropriate data.

Java batch memory-based persistence configuration

The batch persistence allows a job instance to be restarted if the execution ends in a FAILED or STOPPED state. In the absence of batch persistence configuration, Java batch uses a default capability of memory-based persistence to track status, checkpoints, and application persistent data across multiple runs of a job instance.

The default memory-based persistence implementation for Java batch is used by the underlying batch container when there is no batchPersistence and databaseStore elements present in the server.xml file.

Note: As a limitation for Java batch memory-based persistence, by default, persistence in Java batch is based on memory. If the batch container runtime or server JVM crash or are restarted, persistence is lost. This function is intended for development purposes only and is not to be considered for production systems or critical batch processing support.

Java batch database persistence configuration

By default, the batch run time auto-creates non-existent tables based on the server configuration defined in the databaseStore element. The table definitions are customized based on the schema and tablePrefix attributes of the database store.

Alternatively, the ddlGen script can be used to generate a DDL based on the server configuration. If necessary, the DDL can be customized before manually creating the tables. This DDL also incorporates server configuration such as schema andtablePrefix and contains the appropriate SQL for the database type of the data source referenced by the databaseStore.

Note: Customized DDL must use positive integer primary key IDs. As a limitation for database persistence, Java Batch does not accept negative or zero integer IDs persisted in the primary key identity columns. The Java Batch container runtime only runs jobs that use positive integer job IDs persisted in the primary key identity columns.

The auto-creation of tables can be disabled by using the createTables="false" attribute on the databaseStore. This option can be used to ensure that you use manually created tables instead of using auto-created tables if the batch runtime unexpectedly could not find your manually created tables.

The samples shown on this page use the default auto-create behavior. This behavior is equivalent to createTables="true".

Note: To avoid data integrity issues that are caused by having an isolation level less than REPEATABLE_READ, set the isolation level of the data source to TRANSACTION_REPEATABLE_READ. If you do not specify an isolation level, the default depends on the database. In most cases, the default is TRANSACTION_REPEATABLE_READ.

Persistence configuration sample

The following sample configures batch access to the automatically created target database table RUNTIMEDB for Derby.
 <!-- Batch persistence config.  References a databaseStore. -->
    <batchPersistence jobStoreRef="BatchDatabaseStore" />

    <!-- The database store for the batch tables.  -->
    <!-- Note this database store is referenced by the batchPersistence element. -->
    <databaseStore id="BatchDatabaseStore" dataSourceRef="batchDB" schema="JBATCH" tablePrefix="" />

    <!-- Derby JDBC driver -->
    <!-- Note this library is referenced by the dataSource element -->
    <library id="DerbyLib">
        <fileset dir="${server.config.dir}/resources/derby" />
    </library>

    <!-- Data source for the batch tables. -->
    <!-- Note this data source is referenced by databaseStore element --> 
    <dataSource id="batchDB" isolationLevel="TRANSACTION_REPEATABLE_READ" >
        <jdbcDriver libraryRef="DerbyLib" />
        <properties.derby.embedded 
            databaseName="${server.config.dir}/resources/RUNTIMEDB"
            createDatabase="create" 
            user="user" 
            password="pass" />
    </dataSource> 

Icon that indicates the type of topic Reference topic



Timestamp icon Last updated: Tuesday, 12 December 2017
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=rwlp_batch_persistence_config
File name: rwlp_batch_persistence_config.html