What about having a global OC instance per application?

For read-only apps this is the way go (although switching to 3.0 is a good idea if you go this way, as 3.0 fixes a number of synchronization issues that affect shared context use). For read/ write apps you can't do that.

Also, is it safe to start developing on top of the Cayenne 3.x version?

It depends. 3.0 is used in production by a number of people already, so the runtime is reasonably stable. What is unstable is the API for the new features - it can change between the milestones. If you are comfortable with using bleeding edge API, 3.0 is definitely a good option.

Andrus



On Sep 23, 2007, at 5:09 AM, Florin T.PATRASCU wrote:

Hi there,

I am trying to add Cayenne support to the JPublish web framework (http://code.google.com/p/jpublish/) and being very new to Cayenne I would like, if possible, to find which is the best practice for obtaining and using the OC?

I browsed the threads here and most of the information I have show that one of the most common solution is to use the HttpSession. That's clear and I can do that very easy, but I wonder if there is a better way because I would like to use Cayenne for session-less requests as well. So, would it be prohibitive to create an OC for every HttpRequest? aka:

ObjectContext oc = DataContext.createDataContext();

If not, would this pattern affect the server stability (memory, handlers, threads, db pools, etc.)? What about having a global OC instance per application?

Also, is it safe to start developing on top of the Cayenne 3.x version?

Being my first post on this forum, I would like to thank Cayenne's creators for making it available and to you, the users, for the useful information accumulated in this forum during the time.

Thank you,
-florin



Reply via email to