christian wrote:
The concept of an Interceptor is not restricted to a web-environment, although a Servlet filter is an implementation method for Interceptors. By writing an Interceptor you don't "move up the layers", but you simply listen to events in your application (in this case, generated in the presentation layer). It is just application infrastracture code, very much like an application server, which is also not considered to be in any of the traditional layers.
Check out Spring if you don't want to write it all yourself, but its actually very easy for the 90% non-special cases.
My apologies, I thought that both Open Session in View and Servlet Filters involved a servlet. USe of an Interceptor wasn't mentioned in this thread.
When I say "move up the layers", I'm talking about the architecture I have, which uses the HibernateSimpleTransactionManager I described
here. Rather than just allocating a new session/transaction for each new incoming thread, I have greater control over when they are started. Also, those threads (in this case) are not, contrary to what you say, coming from the presentation layer; they are coming from the RMI layer. I don't have a presentation layer up unless I'm testing the user interface.
You've also assumed that I'm using an application server, although I'm not.