abstract class HibernateDaoSupport : DaoSupport
Convenient super class for Hibernate-based data access objects. Requires a SessionFactory to be set, providing a org.springframework.orm.hibernate5.HibernateTemplate based on it to subclasses through the This class will create its own HibernateTemplate instance if a SessionFactory is passed in. The "allowCreate" flag on that HibernateTemplate will be "true" by default. A custom HibernateTemplate instance can be used through overriding NOTE: Hibernate access code can also be coded in plain Hibernate style. Hence, for newly started projects, consider adopting the standard Hibernate style of coding data access objects instead, based on |
|
open class OpenSessionInViewFilter : OncePerRequestFilter
Servlet Filter that binds a Hibernate Session to the thread for the entire processing of the request. Intended for the "Open Session in View" pattern, i.e. to allow for lazy loading in web views despite the original transactions already being completed. This filter makes Hibernate Sessions available via the current thread, which will be autodetected by transaction managers. It is suitable for service layer transactions via org.springframework.orm.hibernate5.HibernateTransactionManager as well as for non-transactional execution (if configured appropriately). NOTE: This filter will by default not flush the Hibernate Session, with the flush mode set to WARNING: Applying this filter to existing logic can cause issues that have not appeared before, through the use of a single Hibernate Session for the processing of an entire request. In particular, the reassociation of persistent objects with a Hibernate Session has to occur at the very beginning of request processing, to avoid clashes with already loaded instances of the same objects. Looks up the SessionFactory in Spring's root web application context. Supports a "sessionFactoryBeanName" filter init-param in |
|
open class OpenSessionInViewInterceptor : AsyncWebRequestInterceptor
Spring web request interceptor that binds a Hibernate This class is a concrete expression of the "Open Session in View" pattern, which is a pattern that allows for the lazy loading of associations in web views despite the original transactions already being completed. This interceptor makes Hibernate Sessions available via the current thread, which will be autodetected by transaction managers. It is suitable for service layer transactions via org.springframework.orm.hibernate5.HibernateTransactionManager as well as for non-transactional execution (if configured appropriately). In contrast to OpenSessionInViewFilter, this interceptor is configured in a Spring application context and can thus take advantage of bean wiring. WARNING: Applying this interceptor to existing logic can cause issues that have not appeared before, through the use of a single Hibernate |
|
open class OpenSessionInterceptor : MethodInterceptor, InitializingBean
Simple AOP Alliance MethodInterceptor implementation that binds a new Hibernate Session for each method invocation, if none bound before. This is a simple Hibernate Session scoping interceptor along the lines of OpenSessionInViewInterceptor, just for use with AOP setup instead of MVC setup. It opens a new Session with flush mode "MANUAL" since the Session is only meant for reading, except when participating in a transaction. |