aspose file tools*
The moose likes Spring and the fly likes why is hibernate with spring also used without utilizing hibernate template feature. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "why is hibernate with spring also used without utilizing hibernate template feature." Watch "why is hibernate with spring also used without utilizing hibernate template feature." New topic
Author

why is hibernate with spring also used without utilizing hibernate template feature.

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 541
spring provides hibernate template but i have seen code where spring is used with hibernate but without utilizing hibernate template feature.Is there some reason that sometimes we should use hibernate with spring but not using hibernate template.?

thanks.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 481
    
    1

Hello!

This link gives the following explanation:

LocalSessionFactoryBean is the preferred way of obtaining a reference to a specific Hibernate SessionFactory, at least in a non-EJB environment. The Spring application context will manage its lifecycle, initializing and shutting down the factory as part of the application.


True person is moral, false is right!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Monica. Shiralkar wrote:spring provides hibernate template but i have seen code where spring is used with hibernate but without utilizing hibernate template feature.Is there some reason that sometimes we should use hibernate with spring but not using hibernate template.?

thanks.


If you are using Hibernate but older versions than 3.1, then the template was helpful because it would hide boiler plate Hibernate code.

Since 3.1 Hibernate no longer has any boilerplate code or checked Exceptions, so if you are using Hibernate 3.1 you will get no benefit using the template in Spring.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 541
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why is hibernate with spring also used without utilizing hibernate template feature.
 
Similar Threads
Using Hibernate directly in a Application
data not saved
Spring framework book
Can @Value inject bean?
Intellij and how it does Hibernate