@Override
   public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain ) throws IOException, ServletException
   {
      try
      {
         sessionFactory.getCurrentSession( ).beginTransaction( );
         filterChain.doFilter( servletRequest, servletResponse );
         sessionFactory.getCurrentSession( ).getTransaction( ).commit( );
         sessionFactory.getCurrentSession( ).close( );
      }
      catch( Throwable throwable )
      {
         try
         {
            if( sessionFactory.getCurrentSession( ).getTransaction( ).isActive( ) )
            {
               sessionFactory.getCurrentSession( ).getTransaction( ).rollback( );
            }
         }
         catch( Throwable t )
         {
            t.printStackTrace( );
         }
      }

   }