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.
OpenSessionInViewInterceptor, OpenSessionInViewFilter, org.springframework.orm.hibernate5.HibernateTransactionManager , TransactionSynchronizationManager, SessionFactory#getCurrentSession()
| Modifier and Type | Field and Description |
|---|---|
| private SessionFactory | sessionFactory
References Deprecated
SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.
|
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| public SessionFactory | getSessionFactory()
References Deprecated
SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.
Return the Hibernate SessionFactory that should be used to create Hibernate Sessions. |
| public Object | invoke(MethodInvocation
the method invocation joinpoint invocation)Implements org. Implement this method to perform extra treatments before and after the invocation. |
| protected Session | Returns: the Session to usethe SessionFactory to use sessionFactory)
References Deprecated
SessionFactory and Session are deprecated or reference (maybe indirectly) at least one deprecated element.
Open a Session for the given SessionFactory. |
| public void | setSessionFactory(SessionFactory sessionFactory)
References Deprecated
SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.
Set the Hibernate SessionFactory that should be used to create Hibernate Sessions. |
| sessionFactory | back to summary |
|---|---|
| private SessionFactory sessionFactory
References Deprecated
See corresponding docs for further information. | |
| OpenSessionInterceptor | back to summary |
|---|---|
| public OpenSessionInterceptor() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
| |
| getSessionFactory | back to summary |
|---|---|
| public SessionFactory getSessionFactory()
References Deprecated
See corresponding docs for further information. Return the Hibernate SessionFactory that should be used to create Hibernate Sessions.
| |
| invoke | back to summary |
|---|---|
| public Object invoke(MethodInvocation invocation) throws Throwable Implements org. Doc from org. Implement this method to perform extra treatments before and
after the invocation. Polite implementations would certainly
like to invoke
| |
| openSession | back to summary |
|---|---|
| protected Session openSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException
References Deprecated
See corresponding docs for further information. Open a Session for the given SessionFactory. The default implementation delegates to the
| |
| setSessionFactory | back to summary |
|---|---|
| public void setSessionFactory(SessionFactory sessionFactory)
References Deprecated
See corresponding docs for further information. Set the Hibernate SessionFactory that should be used to create Hibernate Sessions. | |