cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Servlet Filters
Date Thu, 20 Aug 2009 14:27:18 GMT
My current view of the WebApplicationContextFilter is that it is just  
an example for users on how to bootstrap Cayenne, not *the* only way  
of doing it. Maybe we need to reflect that in the docs.

Modern JEE environment is rather diverse as far as configuration  
approaches, and this is multiplied by the number of Cayenne context  
creation strategies. Some apps would use Spring, some Guice, or  
web.xml, yet some would want sessions scoped contexts vs. request or  
other scope. So my recommendation is to use  
WebApplicationContextFilter as an template to write your own filter/ 
service/whatever, as appropriate.


On Aug 20, 2009, at 4:52 PM, Michael Gentry wrote:

> I'm starting to use the servlet filter setup
> ( and got it
> working, but I'm wondering if there is a way to customize the DC
> creation that I'm missing.
> The WebApplicationContextFilter class calls
> ServletUtil.getSessionContext(session).
> ServletUtil.getSessionContext() checks for an existing DC with:
> 	    if (ctxt == null) {
>                ctxt = DataContext.createDataContext();
> Prior to switching to the servlet filter, I was creating my DC using
> DataContext.createDataContext(false) because I was having caching
> issues with not getting the freshest data from the DB.  Is there an
> easy way to get the DC's created with the false parameter as the
> default?  (Without having a custom build of Cayenne.)
> Thanks,
> mrg

View raw message