Posts

Showing posts from May, 2013

Spring 3 Part 8: Spring Hibernate open session in view

Image
This is the 8th part of the Spring 3 Series . In this blog I am going to use Hibernate 3.5.2 to explain the use of Spring Transaction which fulfil the requirements of open session in view pattern. First understand some important concepts in Hibernate. First of all, it is very important to understand the object states in the Hibernate. Transient object will become a persistent object in the context of active session. This persistent object represent one row of the data table. There can be two transient object references which are not refer to the same object but can hold same data. These objects are identical only in the persistence context (persistent objects are identical) because persistence objects are identified based on the database primary key. Therefore, persistence object identifier is the same as data table identifier.  For the transient and detached object, equal() and hashcode() are the methods to be implemented to define the identifier. Figure 1: