Over a million developers have joined DZone.

Java EE Batch Applications in NetBeans IDE

DZone's Guide to

Java EE Batch Applications in NetBeans IDE

· Integration Zone ·
Free Resource

How to Transform Your Business in the Digital Age: Learn how organizations are re-architecting their integration strategy with data-driven app integration for true digital transformation.

This article demonstrates how to define a simple job (JSR 352) using the j Batch Suite in NetBeans  IDE and how to implement the corresponding batch artifacts. 



    • Job
    • Batchlet  
    • Decision
    • Transition - Next
    • Flow


Batch processing is execution of series of "jobs" that is suitable for non-interactive, bulk-oriented and long-running tasks.Typical examples are end-of-month bank statement generation, end-of-day jobs such as interest calculation, and ETL (extract-transform-load) in a data warehouse. 

JSR - 352

JSR 352 defines a Job Specification Language (JSL) to define batch jobs, a set of interfaces that describes the artifacts that comprise the batch programming model to implement batch business logic . Using jBatch Suite developer may design JSL and generate Job file & source code (batch artifatcs ) .


A Job is an instance that encapsulates an entire batch process.A job is typically put together using a Job Specification Language and consists of multiple steps. The Job Specification Language for JSR 352 is implemented with XML and is referred as "Job XML".


With JSR 352, a Job is simply a container for Steps. It combines multiple steps that belong logically together in a flow .  Each step may be either a chunk type step or batchlet type step.


The batchlet element specifies a task-oriented batch step.  It is mutually exclusive with the chunk element.  Steps of this type are useful for performing a variety of tasks that are not item-oriented, such as executing a command or doing file transfer.

Test your first Job file

The batch job is not automatically started when the application is deployed. A batch job must be initiated explicitly, say, from a servlet or from an Enterprise JavaBeans (EJB) timer or an EJB business method.

JobOperator provides an interface to manage all aspects of job processing, including operational commands, such as start, restart, and stop, as well as job repository commands, such as retrieval of job and step executions.

BatchRuntime.getJobOperator().start("myJob", new Properties());
The batch runtime loads the batch artifacts you specify in your JSL and runs the job on a separate thread.  All steps in your job run on the same thread unless you are using partitions or splits. 


A decision provides a customized way of determining sequencing among steps, flows, and splits. A decision batch artifact decide the next transition. The decision uses any of the transition elements, stop, fail, end, and next elements to select the next transition.

Next Transition

The next element is used to transition the current decision to the next execution element. Multiple next elements may be specified in the current containment scope.


A flow defines a sequence of execution elements(step, flow, decision, and split) that execute together as a unit.  When the flow is finished, it is the entire flow that transitions to the next execution element.   A flow may transition to a step, split, decision, or another flow.



Build and deploy API integrations 7x faster. Try the Cloud Elements 100% RESTful platform for 30 days free. Access your trial here.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}