public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
JPAContext context = JPA.instance.getDefaultConfig().getContext();
context.getEntityManager();
logger.debug("Initialized context and transaction");
try {
logger.debug("Executing ServletRequest");
chain.doFilter(request, response);
logger.debug("Done with execution of ServletRequest");
} finally {
logger.debug("Closing context and transaction");
if (context.isTxnOpen()) {
context.closeTxn(true);
}
context.close();
logger.debug("Closed context and transaction");
}
}