Popular Posts

Monday, April 02, 2012

Spring Hibernate Integration, how to use these frameworks with each other & best practice.

Two Steps to integrate Hibernate with Spring:

1) Define DataSource & Hibernate SessionFactory in the spring application context file.
2) Now to integrate the Hibernate with your application DAO class - there are three ways / options:
2.1)) Extending 'HibernateDaoSupport' (using Inheritance)
2.2)) Injecting 'HibernateTemplate' (using Composition)
2.3)) Directly injecting the Hibernate sesisonFactory in your DAO class. In this case - there would not be any dependency upon any Spring f/w class.

If you are using Hibernate 3.x - you shall go with 3rd option.


1 comment:

for IT the said...

I have read your blog its very attractive and impressive. I like it your blog.

Spring online training Spring online training Spring Hibernate online training Spring Hibernate online training Java online training

spring training in chennai spring hibernate training in chennai