I would just use a ThreadLocal variable in some static EntityManagerUtil/Helper class.
** Martin 2009/6/5 Frank Tegtmeyer <[email protected]>: > Hi, > > would the Request object be a good place to store a JPA EntityManager? > It would be created in onBeginRequest() and destroyed in > onEndRequest() of the RequestCycle object. > > I saw two other options already: > - use a filter in combination with Spring (I don't want to use Spring > yet - this would add to all the new stuff I have to learn so far) > - use a ThreadLocal object like in > http://rattlab.net/2008/10/persistenz-fur-den-feedreader/ > in the class JpaUtil. I don't like this approach because it depends > on the implicit assumption that each request is handled in a thread > (this depends on Wicket implementation details, therefor I dislike it) > > Any advice is welcome. > > Regards, Frank > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
