On Java Development

All things related to Java development, from the perspective of a caveman.

Archive for the ‘Spring’ Category

JPA Entity Manager Factory, Transaction Manager, Datasource and JNDI Configuration

without comments

Introduction

This post describes the contents of the file “jpaDataSourceContext” found in baseproject. This file contains datasource and JNDI definitions using Spring’s JPA support for Entity Manager Factory, Transaction Manager and Hibernate Adapters. The file is read during the initial phase of the application’s startup processing which occurs when the server is started. This means all data source/JNDI references, used or not, must be present and valid.
Read the rest of this entry »

Written by admin

February 19th, 2015 at 10:52 am

Use Spring to load a SelectOneMenu

without comments

Introduction

This post shows how to use Spring to load a JSF SelectOneMenu component. The values for the menu are placed into a simple POJO by Spring which is then referenced by the SelectOneMenu component for loading.
Read the rest of this entry »

Written by admin

December 10th, 2014 at 11:17 am

JDBC Connections vs JNDI Connections

without comments

Introduction

This post describe differences between the Java Database Connection API (JDBC) and the Java Naming and Directory Interface (JNDI). These technologies are used to obtain database connections.
Read the rest of this entry »

Written by admin

June 8th, 2014 at 11:16 am

Using Spring to Create Rules

without comments

Introduction

This post shows how Spring can be used to create classes that act as a rule processor or validator. The example presented is very simple but should serve to show the potential for other cases.
Read the rest of this entry »

Written by admin

April 11th, 2014 at 11:09 am

Calling RPG or CL Programs with SETLIBLEXEC

without comments

Introduction

This post shows how to call RPG and CL programs using SETLIBLEXEC which is a stored procedure residing on the iSeries (only in QGPL). SETLIBLEXEC accepts parameter values for the environment name of the library list to be used when it runs the name of the program to be called and the parameter values needed by that program.
Read the rest of this entry »

Written by admin

April 3rd, 2014 at 1:42 pm

Using ${catalina.home}

without comments

Introduction

This post shows how ${catalina.home}, which is set by the application server, can be leveraged to prevent hard-coding of paths. In the event that the application is moved to another server, which is the case when servers are upgraded, the application does not have to be modified and moved as-is.
Read the rest of this entry »

Written by admin

April 1st, 2014 at 12:20 pm

Using baseproject’s ApplicationContextManager class

without comments

Introduction

This post focuses on the ApplicationContextManager class that comes with baseproject and shows how it is used to obtain the application’s properties from a bean defined to the Spring Context.
Read the rest of this entry »

Written by admin

April 1st, 2014 at 10:13 am

Using Java Reflection to call methods of a Java Class

without comments

Introduction

This post shows how to use Java Reflection to call getter methods of a Spring context bean (a POJO). The POJO contains the application’s property values and the values need to be logged to the application’s log-file during the application’s startup phase. Since the property name/value pairs differ across projects this means the bean’s method names for each property are also different since their names reflect the names of the properties. Traditional approaches to logging the property values means writing customized code to explicitly call each method by name. Adding to this, whenever a new property is added, the logic has to be modified to include a call to the new method.
Read the rest of this entry »

Written by admin

March 7th, 2014 at 6:03 am

Anatomy of a Web Application

without comments

Introduction

This post is for the reader who is curious about the architecture, components and technologies that make up a web application.
Read the rest of this entry »

Startup Servlet

without comments

Introduction

This post is about using a servlet to perform the initialization of a web application. In an RPG program this would be performed using *INZSR but for web applications a servlet is used. This approach allows tasks to be performed only when the server starts. Since the servlet is part of the application the tasks performed are tailored for it alone.
Read the rest of this entry »

Written by admin

January 18th, 2014 at 6:47 pm