You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by jotpe <jo...@gmail.com> on 2014/01/14 10:43:48 UTC

child contexts in a webapp with cayenne 3.2

Hello,

how can I create a child context in 3.2?

class ObjectContext in 3.0 the method createChildContext is deprecated and
CayenneRuntime.getContext(DataChannel) should be used.

How can I receive the CayenneRuntime object in my webapplication, where no
ServerRuntime instance is available directly?

Regards Johannes

Re: child contexts in a webapp with cayenne 3.2

Posted by Andrus Adamchik <an...@objectstyle.org>.
How you access various app services depends on your app. If you are using injection, it is declarative and fairly trivial. If not, you can either use a static singleton, or look things up in ServletContext. E.g. if you are using CayenneFilter to bootstrap Cayenne, you’d do this:

ServletContext servletContext = .. 
CayenneRuntime r = WebUtil.getCayenneRuntime(servletContext);

Andrus


On Jan 14, 2014, at 12:43 PM, jotpe <jo...@gmail.com> wrote:
> Hello,
> 
> how can I create a child context in 3.2?
> 
> class ObjectContext in 3.0 the method createChildContext is deprecated and
> CayenneRuntime.getContext(DataChannel) should be used.
> 
> How can I receive the CayenneRuntime object in my webapplication, where no
> ServerRuntime instance is available directly?
> 
> Regards Johannes