Java EE 7 SDK 

Samples Main Page

The Payroll Batch Sample Application

This sample demonstrates how to use the javax.batch.operations.JobOperator interface to submit batch jobs.

Description

This sample application demonstrates how to use the Batch Processing API (JSR 352) to submit batch jobs. A batch job is typically a long-running process that involves a sequence of steps. This sample processes a simple payroll by submitting a payroll job to the batch runtime using the JobOperator.start() method. This sample also demonstrates how to use the ItemReader, ItemProcessor, and ItemWriter interfaces.

The sample contains a singleton EJB that holds payroll records for a set of employees for three months. The singleton bean also holds the processed payroll records.

The job XML file for this sample specifies the process step with three batch artifacts:

This sample application uses the embedded JavaDB database service included with the Glassfish server.

The following is a list of servlets included in this sample:

URI pattern Description
/payroll/JobSubmitterServlet Displays payroll input records and allows starting a payroll processing job.

The application is built and deployed as a WAR file.

Key Features

This sample application demonstrates the following key features:

Building, Deploying, and Running the Application

Perform the following steps to build, deploy, and run the application:

  1. Set up your build environment and configure the application server with which the build system has to work by following the common build instructions.
  2. samples_install_dir is the sample application base directory. Go to: samples_install_dir/javaee7/batch/payroll.
  3. Build the sample application by running the mvn package command from a command line terminal.
  4. Deploy the sample application by running the asadmin deploy --force target/payroll.war command from a command line terminal.
  5. The front page of this sample is at http://localhost:8080/payroll/JobSubmitterServlet.
    (The port number might vary.)
  6. Use the mvn clean command from a command line terminal to clean up the target directory.
  7. Undeploy the sample application by running the asadmin undeploy payroll command from a command line terminal.

Troubleshooting

If you have problems when running the application, refer to the troubleshooting document.


 

Copyright © 1997-2013 Oracle and/or its affiliates. All rights reserved.