emmanuel wrote:
Using the Thread session pattern, I recommend you to manage Tx at a higher level (process level).
Have a look a Spring framework (at least for the concepts), it's based on pretty good patterns.
Hi, thanks for answering.
OK, let me see if I get you right.
My app is a servletbased one in TOMCAT. The overall idea is this:
UI (JSP, HTML)
communicates with
HttpHandler (invoked through a homemade front end servlet)
uses (through instantiation)
DAO-class
uses
Hibernate
communicates with
DB
Your suggestion is to move the operation (database calls) from the "DAO-class"-layer to "HttpHandler"-layer. Do I get it right?
This raises questions. For example, if I would want to keep the business layer-model(DAO-classes) , how do I best do that? Move the instatiation of the Session (or the Transaction even or both) to the HttpHandler layer, and send the Session (and/or Transaction) created to the DAO-methods as (an) argument(s)?
I feel a lot of portability/extendability is lost if I do a lot of melt-together of the HttpHandler and DAO-class layers. This is a fundamental design issue concerning servlets and Hibernate to which I haven't found a good answer yet.
Sincerely,
/F