JBatch on Payara Server 151 now supports 5 different database types

Uncategorized

In this blog, we provide you with an overview of the extended JBatch features available in the upcoming release of Payara 4.1.151. We will firstly present what JBatch on Payara 4.1.151 has to offer, if one could not guess by the title, and then provide a brief overview on how to configure JBatch on Payara.

Payara JBatch Overview

  • Glassfish 4.1 GA comes bundled with JBatch 1.0, Payara 4.1.151 will be shipped with JBatch 1.0.1 b04 which incorporates all the latest JBatch bug fixes.
  • We have extended JBatch to use 5 different persistence managers which allows JBatch to be supported across 5 different databases including: Oracle, PostgreSQL, MySQL, DB2 and Derby.
  • We allow for JBatch database table names to be prefixed and suffixed across all database types.
  • Automatic database schema creation if JBatch schema objects do not already exist.
  • We have extended the asadmin batch runtime options which can also be configured in the DAS console.

JBatch Feature Usage on Payara 4.1.151

In this section, I will demonstrate how to use some of the features discussed above and illustrate JBatch on Payara by providing application screenshots of a running JBatch sample application.

Setting the JBatch JDBC resource

To set the JDBC resource named “jdbc/oracledatasource” to be used by JBatch whereby JBatch tables will be created with the table prefix “p” and table suffix “s” under the schema name “testschema”, execute the following asadmin command:

asadmin set-batch-runtime-configuration --datasourcelookupname jdbc/oracledatasource –schemaname testschema --tableprefix p --tablesuffix s

We can also set the above JBatch Properties in the DAS console as we can see from Figure 1 below. As mentioned earlier, if the JBatch database schema objects do not exist then they will be created the first time a new JBatch application had been deployed and run on Payara. The table prefix, suffix and schema name properties noted above are optional and if one does not specify values for these properties default values are used. For the schema name, the user associated with the JDBC connection pool resource will be used as the default value. Once the relevant JBatch properties above have been set and the JBatch application has been deployed, we can now execute JBatch applications on Payara. I have deployed a sample JBatch applications which can be downloaded from https://github.com/javaee-samples/javaee7-samples and built using maven 3. The payroll JBatch sample application calculates monthly payroll for different employees in a company. Below we can view screenshots from the application running and the relevant JBatch tables created with the specified table prefix and suffix mentioned above.

JBatch Configuration Properties in the DAS console
Figure 1: JBatch Configuration Properties in the DAS console
Payroll JBatch Sample Application Output
Figure 2: Payroll JBatch Sample Application Output
JBatch Database Table View in SQLDeveloper
Figure 3: JBatch Database Table View in SQLDeveloperFigure 3: JBatch Database Table View in SQLDeveloper

Summary

Payara Server 4.1.151 will be released on the 30th January so have fun developing and running your JBatch applications on Payara, you now have a greater choice of databases to persist your JBatch application data to!

Comments (0)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

Related Posts

6 minutes
Uncategorized

Conf42 IoT 2024: At the Edge of Robotic Applications

At the latest Conf42 Internet of Things (IoT) 2024 conference, our Payarans deliver a keynote, titled “At the Edge […]

5 minutes
Uncategorized

10 Reasons Why Java is the Future of Enterprise App Development in 2025

Java has been a core element of enterprise application development for decades, and its relevance will continue to grow […]

5 minutes
Uncategorized

Keen To Slash Software Development Costs? Here’s What To Look For In A Middleware Solution

For technology companies, cost effectiveness in software and application development isn’t just about saving money. It is about delivering […]