> Yes, this is how the Datacontext is created:
>
> DataContext ctxt = (DataContext)
> request.getSession().getAttribute("context");
>
> //this is where we choke.
> SelectQuery query = new SelectQuery(Artist.class);
>
This line shouldn't cause the NPE, the one with "performQuery" maybe?
Anyway, I think I know what it is. And it is indeed a bug in the tutorial
(I need to doublecheck this some more when I get home).
You preserved these lines in your web.xml, right?
<listener>
<listener-class>webtest.CustomConfiguration</listener-class>
</listener>
If so, DataContext is created by CustomConfiguration's superclass when the
session is staryed. But the key to retrieve it is defined under
ServletConfiguration.DATA_CONTEXT_KEY as "cayenne.datacontext". Try using
this key instead. Or use CustomConfiguration.getDefaultContext().
Let me know if this works. In the meantime I will see if tutorial code
needs to be fixed.
Andrus
This archive was generated by hypermail 2.0.0 : Tue Feb 04 2003 - 16:05:46 EST