jQuery in Action, 2nd edition*
The moose likes Other Application Frameworks and the fly likes Best Approach when using Spring Support for Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Best Approach when using Spring Support for Hibernate " Watch "Best Approach when using Spring Support for Hibernate " New topic
Author

Best Approach when using Spring Support for Hibernate

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi Ranchers ,


when using Spring and Hibernate in combinaton

when is it feasable to use HibernateTemplate and when is it good to go for a HibernateDAOSuppourt ??



Please share your ideas .

Thanks


Save India From Corruption - Anna Hazare.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
I recommend you to read API documentation.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Kengkaj Sathianpantarit wrote:I recommend you to read API documentation.


I agree with Kengkaj, reading the docs makes it so much clearer and this is a big question to answer in a post.

But because this is JavaRanch, I will answer a little bit to help you get started.

1. It depends on which version of Spring and what version of Hibernate you are using.

If you are using the latest versions of both, then my answer is to use neither. Just inject a SessionFactory into your DAO classes.

If you are using Hibernate 3.0 and before where you had to use session.beginTransaction() and try/catches, then I recommend you use the HibernateTemplate.

Maybe really older versions using the DAOSupport class might have made sense, but once you use it you are even more tightly coupled to Spring because your class is now extending a Spring specific class.

Good Luck

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you very much Mark
 
 
subject: Best Approach when using Spring Support for Hibernate
 
Similar Threads
spring+hibernate
Spring Live
Problem with @Transactional (Transaction is not getting rollbacked)
Spring Hibernate best practices
Hibernate and Container Managed Transaction