Class OpenSessionInterceptor

java.lang.Object
org.springframework.orm.hibernate5.support.OpenSessionInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor, InitializingBean

public class OpenSessionInterceptor extends Object implements 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.

Since:
4.2
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • OpenSessionInterceptor

      public OpenSessionInterceptor()
  • Method Details