> > > I try to keep my UI logic, my business logic, and my persistence > strategy separate. Putting the EntityManager in the Request means you > have to pass the Request around into your business logic layer. By > putting it in a ThreadLocal, the UI and business layers can be > blissfully unaware of its existance. > > BTW I use Spring's OpenEntityManagerInViewFilter for this. Works very > well. >
If you are using a ThreadLocal it is worth reading this.. http://www.javaspecialists.eu/archive/Issue164.html as it covers issues of ThreadLocal and garbage collection. HTH Adrian
