filter2.init(filterConfig2);
final FilterChain filterChain = new FilterChain() {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) {
HibernateTransactionManager tm = new HibernateTransactionManager(sf);
TransactionStatus ts = tm.getTransaction(
new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_SUPPORTS));
org.hibernate.Session sess = SessionFactoryUtils.getSession(sf, true);
SessionFactoryUtils.releaseSession(sess, sf);
tm.commit(ts);
servletRequest.setAttribute("invoked", Boolean.TRUE);
}
};
final FilterChain filterChain2 = new FilterChain() {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
throws IOException, ServletException {
HibernateTransactionManager tm = new HibernateTransactionManager(sf2);
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
tm.commit(ts);
filter.doFilter(servletRequest, servletResponse, filterChain);
}
};
FilterChain filterChain3 = new PassThroughFilterChain(filter2, filterChain2);