Category Archives: Hibernate

Chunk Oriented Processing in Spring Batch

Big Data Sets’ Processing is one of the most important problem in the software world. Spring Batch is a lightweight and robust batch framework to process the data sets.

Spring Batch Framework offers ‘TaskletStep Oriented’ and ‘Chunk Oriented’ processing style. In this article, Chunk Oriented Processing Model is explained. Also, TaskletStep Oriented Processing in Spring Batch Article is definitely suggested to investigate how to develop TaskletStep Oriented Processing in Spring Batch.

Chunk Oriented Processing Feature has come with Spring Batch v2.0. It refers to reading the data one at a time, and creating ‘chunks’ that will be written out, within a transaction boundary. One item is read from an ItemReader, handed to an ItemProcessor, and written. Once the number of items read equals the commit interval, the entire chunk is written out via the ItemWriter, and then the transaction is committed.

Basically, this feature should be used if at least one data item’ s reading and writing is required. Otherwise, TaskletStep Oriented processing can be used if the data item’ s only reading or writing is required.

Chunk Oriented Processing model exposes three important interface as ItemReader, ItemProcessor and ItemWriter via org.springframework.batch.item package.

ItemReader : This interface is used for providing the data. It reads the data which will be processed.

ItemProcessor : This interface is used for item transformation. It processes input object and transforms to output object.

ItemWriter : This interface is used for generic output operations. It writes the datas which are transformed by ItemProcessor. For example, the datas can be written to database, memory or outputstream (etc). In this sample application, we will write to database.

Let us take a look how to develop Chunk Oriented Processing Model.

Used Technologies :

JDK 1.7.0_09
Spring 3.1.3
Spring Batch 2.1.9
Hibernate 4.1.8
Tomcat JDBC 7.0.27
MySQL 5.5.8
MySQL Connector 5.1.17
Maven 3.0.4

JSF2 + Primefaces3 + Spring3 & Hibernate4 Integration Project

This article shows how to integrate JSF2, PrimeFaces3, Spring3 and Hibernate4 Technologies. It provides a general project template for Java developers.

Also if Spring is not used for Business and Data Access layer, JSF – PrimeFaces & Hibernate Integration Project can be offered.

Used Technologies :

JDK 1.6.0_31
Spring 3.1.1
JSF 2.1
Hibernate 4.1.0
Primefaces 3.1.1
MySQL Connector 5.1.17
MySQL 5.5.8
c3p0 0.9.1.2
Tomcat 7.0
Maven 3.0.2

JSF – PrimeFaces & Hibernate Integration Project

This article shows how to develop a project by using JSF, PrimeFaces and Hibernate. A sample application is below :

Used Technologies :

JDK 1.6.0_21
Maven 3.0.2
JSF 2.0.3
PrimeFaces 2.2.1
Hibernate 3.6.7
MySQL Java Connector 5.1.17
MySQL 5.5.8
Apache Tomcat 7.0

Hibernate Hello World Application

This article shows how to develop a new Hibernate Hello World project. A sample application is below :

Using Technologies :

JDK 1.6.0_21
Maven 3.0.2
Hibernate 3.6.7
MySQL Java Connector 5.1.17
MySQL 5.5.8

STEP 1 : CREATE USER TABLE

A new USER Table is created by executing below script:

CREATE TABLE USER (
   id int(11) NOT NULL,
   name varchar(45) NOT NULL,
   surname varchar(45) NOT NULL,
   PRIMARY KEY (`id`)
);

Hibernate Overview

This article tells Hibernate which is a powerful and high-performance Object Relational Mapping Framework. Hibernate was developed by Gavin King in 2001.
It maps Java classes to database tables and from Java data types to SQL data types. A Java Object shows an record in the table which it is mapped. It is also an implementation of JPA.

Hibernate Advantages :

1) Hibernate is Database Independent so selected database can be used.
2) Easy installation
3) Hibernate has got layered architecture.
4) Development with Hibernate is easier than JDBC.
5) Connection pool APIs(c3p0, dbcp) can be integrated with Hibernate easily.