On Fri, Jun 05, 2009 at 04:28:07PM +0200, Frank Tegtmeyer wrote:
> 
> > Don't fall into the trap of premature optimization!
> 
> Hm. Maybe I'm in this trap already.
> But what is wrong with binding a resource directly to the request when 
> it is used exactly for the lifetime of the request? For me this only 
> sounds logical compared to the pragmatic approach using a ThreadLocal 
> object.
> Are there any technical reasons against storing in the request?
> 

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.

jk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to