public class SessionHandler extends Object implements MethodInterceptor, ApplicationContextAware
HibernateInterceptor for stateless
services but which keeps a WeakHashMap of sessions keyed by
the stateful service reference.
original idea from:
http://opensource2.atlassian.com/confluence/spring/pages/viewpage.action?pageId=1447
See also: http://sourceforge.net/forum/message.php?msg_id=2455707
http://forum.springframework.org/archive/index.php/t-10344.html
http://opensource2.atlassian.com/projects/spring/browse/SPR-746
and these: http://www.hibernate.org/43.html#A5
http://www.carbonfive.com/community/archives/2005/07/ive_been_meanin.html
http://www.hibernate.org/377.html| Constructor and Description |
|---|
SessionHandler(org.hibernate.SessionFactory factory)
Constructor taking a
SessionFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanThread() |
protected Object |
getThis(MethodInvocation invocation) |
Object |
invoke(MethodInvocation invocation)
delegates to
HibernateInterceptor or manages sessions internally,
based on the type of service. |
protected void |
putStatus(MethodInvocation invocation,
ome.tools.hibernate.SessionStatus status) |
protected ome.tools.hibernate.SessionStatus |
removeStatus(MethodInvocation invocation) |
void |
setApplicationContext(ApplicationContext applicationContext) |
public SessionHandler(org.hibernate.SessionFactory factory)
SessionFactory.
A new HibernateInterceptor will be created.factory - Not null.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionprotected Object getThis(MethodInvocation invocation)
protected void putStatus(MethodInvocation invocation, ome.tools.hibernate.SessionStatus status)
protected ome.tools.hibernate.SessionStatus removeStatus(MethodInvocation invocation)
public void cleanThread()
public Object invoke(MethodInvocation invocation) throws Throwable
HibernateInterceptor or manages sessions internally,
based on the type of service.invoke in interface MethodInterceptorThrowable
Version: 5.2.1-ice35-b15
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.