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
Deprecated
as a consequence of
SessionFactory being deprecated.
|
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc.
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()
Deprecated
as a consequence of
Return the Hibernate SessionFactory that should be used to create Hibernate Sessions.
SessionFactory being deprecated.
|
| public Object | invoke(MethodInvocation
the method invocation joinpoint invocation)Implements org. |
| protected Session | Returns: the Session to usethe SessionFactory to use sessionFactory)
Deprecated
as a consequence of
Open a Session for the given SessionFactory.
SessionFactory and Session being deprecated.
|
| public void | setSessionFactory(SessionFactory sessionFactory)
Deprecated
as a consequence of
Set the Hibernate SessionFactory that should be used to create Hibernate Sessions.
SessionFactory being deprecated.
|
| sessionFactory | back to summary |
|---|---|
| private SessionFactory sessionFactory
Deprecated as a consequence of | |
| 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()
Deprecated as a consequence of 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
Deprecated as a consequence of Open a Session for the given SessionFactory. The default implementation delegates to the
| |
| setSessionFactory | back to summary |
|---|---|
| public void setSessionFactory(SessionFactory sessionFactory)
Deprecated as a consequence of Set the Hibernate SessionFactory that should be used to create Hibernate Sessions. | |