Interface that specifies a basic set of Hibernate operations.
Implemented by HibernateTemplate. Not often used, but a useful option
to enhance testability, as it can easily be mocked or stubbed.
Provides HibernateTemplate's data access methods that mirror
various Session methods. See the Hibernate Session javadocs
for details on those methods.
Note that operations that return an Iterator (i.e. iterate)
are supposed to be used within Spring-driven or JTA-driven transactions
(with HibernateTransactionManager, JtaTransactionManager, or EJB CMT).
Else, the Iterator won't be able to read results from its ResultSet anymore,
as the underlying Hibernate Session will already have been closed.
Lazy loading will also just work with an open Hibernate Session,
either within a transaction or within OpenSessionInViewFilter/Interceptor.
Furthermore, some operations just make sense within transactions,
for example: contains, evict, lock,
flush, clear.
Provides HibernateTemplate's data access methods that mirror various Session methods. See the Hibernate Session javadocs for details on those methods.
Note that operations that return an Iterator (i.e.
iterate) are supposed to be used within Spring-driven or JTA-driven transactions (with HibernateTransactionManager, JtaTransactionManager, or EJB CMT). Else, the Iterator won't be able to read results from its ResultSet anymore, as the underlying Hibernate Session will already have been closed.Lazy loading will also just work with an open Hibernate Session, either within a transaction or within OpenSessionInViewFilter/Interceptor. Furthermore, some operations just make sense within transactions, for example:
contains,evict,lock,flush,clear.