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.
Andrus
On Aug 20, 2009, at 4:52 PM, Michael Gentry wrote:
I'm starting to use the servlet filter setup
(http://cayenne.apache.org/doc/web-applications.html) 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