|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.davesag.generica.servlet.filter.PersistenceManagementFilter
Filter which manages a ThreadLocal hibernate session. Obtain the session by calling Persistance.getSession(somesessionfactory).
| Field Summary | |
protected static ThreadLocal |
HIBERNATE
Holds the current hibernate session, if one has been created. |
| Constructor Summary | |
PersistenceManagementFilter()
|
|
| Method Summary | |
void |
destroy()
does nothing. |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
open a new hibernate session if one has not already been opened, and then close it after the request has been handled. |
static Session |
getSession(SessionFactory factory)
Gets a session that will be closed by this filter at the end of the request. |
void |
init(FilterConfig filterConfig)
does nothing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static ThreadLocal HIBERNATE
| Constructor Detail |
public PersistenceManagementFilter()
| Method Detail |
public void init(FilterConfig filterConfig)
throws ServletException
init in interface FilterfilterConfig - the filter config object
ServletException - if anything went wrong.
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws IOException,
ServletException
doFilter in interface Filterrequest - the http requestresponse - the http responsechain - the next filter in the chain.
IOException - if anything went wrong with io.
ServletException - if anythign else went wrong.
IllegalStateException - if there is already a hibernate session
with this thread.
public static Session getSession(SessionFactory factory)
throws HibernateException
factory - The session factory to use to create this session.
HibernateException - if there was a problem.public void destroy()
destroy in interface Filter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||