If it's a servlet app, then the runtime is created in CayenneFilter and
bound to the thread for each request and you access it via

WebUtil.getCayenneRuntime(servletContext);


Or you can get a context from the injector if you have bound that to a
thread:

ObjectContext context =
CayenneRuntime.getThreadInjector().getInstance(ObjectContextFactory.class
).createContext();


If not a servlet app, then yeah, I'd just store it in a static variable or
application instance.



On Thu, Feb 28, 2013 at 8:43 AM, Michael Gentry <mgen...@masslight.net>wrote:

> Is there an existing place (class) in 3.1 to stuff a ServerRuntime instance
> for global use or is it expected that you'll create a separate class to
> hold a static instance variable of ServerRuntime?
>
> Thanks,
>
> mrg
>

Reply via email to