Deserializing JSON to Java Object

In this post under Gson. I will show how to deserialize a JSON data back to Java object using Gson framework. For our example I will use the below json data. The json data contains employee information. employee.json {“id”:1,”name”:”employee1″,”ssn”:1234} The class structure of Employee is as shown below Employee class public class Employee { private…… Continue reading Deserializing JSON to Java Object

Chaining multiple JobParametersValidator implementations

In this post under Spring Batch, I will show how to chain multiple JobParametersValidator interface implementations. For our example I will create two JobParametersValidator interface implementations as shown below Validator1 package package23; import java.util.Map; import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersInvalidException; import org.springframework.batch.core.JobParametersValidator; public class Validator1 implements JobParametersValidator { @Override public void validate(JobParameters jobParameters) throws JobParametersInvalidException…… Continue reading Chaining multiple JobParametersValidator implementations

Accessing cache provider’s Cache implementation

This post explains how to access the cache provider’s Cache implementation through java cache api. In all my previous post related to Caching, I gave examples where I was accessing cache provider for caching functionality through the Java Cache API. The java cache api is set of specifications, which are implemented by cache providers and…… Continue reading Accessing cache provider’s Cache implementation

Validating Items using ValidatingItemProcessor

In this post under Spring Batch, I will introduce ValidatingItemProcessor and explain how to use it with an example. ValidatingItemProcessor is a implementation of org.springframework.batch.item.ItemProcessor interface. As mentioned in my previous posts, implementation of ItemProcessor is used to place business logic. The implementation of ItemProcessor which contains the business logic is placed between the reader…… Continue reading Validating Items using ValidatingItemProcessor

Unidirectional Many to Many association mapping (without annotations)

In this post under Hibernate, I will explain how to create a unidirectional many to many association between objects using a mapping file with an example. For our example, we will create the below two tables. Data Definition Language CREATE TABLE `doctor1` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL DEFAULT ‘0’, `description`…… Continue reading Unidirectional Many to Many association mapping (without annotations)