The general way it is done for j2ee apps is to create the ObjectContext in either a request attribute or a ThreadLocal at the start of the request and remove it at the end of the request. Lots of ways to do it, though. I also tend to check for a dirty ObjectContext in the removal part to insure that there are no uncommitted changes left over -- indicates a programming error on my part.
On Sat, Nov 29, 2014 at 2:29 AM, Andrew Lindesay <[email protected]> wrote: > Hello Simo; > > I do not have any experience with the frameworks that you have mentioned, > but I see that "dropwizard" uses Jersey. Have you considered creating a > Jersey filter that would assign an ObjectContext for use during that > request? > > Regards; > > > On 29/11/14 7:12 am, Simo Sentissi wrote: >> >> I am brand new to Cayenne. I was referred to it on Wed when I was told >> that it is a requirement for a future project. I really liked the getting >> started documentation and I am impressed with it. Just do not know how I >> never hear about it until now. I looked for a google group until I >> subscribed to this user list. >> >> Until now I used jdbi or jdbc within either Dropwizard or Spark >> frameworks. Both frameworks "almost" abstract away lots of servlets >> interaction (DW case). Applications in both framework are bootstrapped >> within either a main or run method in a startup class. >> >> Since my future use case project will necessitate Cayenne and with a web >> data context -per request- , and before I start figuring out how to obtain a >> per request data context session within either spark or DW I was wondering >> if anybody did have the same use case? And how they went about it. > > > > -- > Andrew Lindesay
