Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Best Approach when using Spring Support for Hibernate

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend you to read API documentation.
 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Mark
 
My, my, aren't you a big fella. Here, have a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!