On Sep 1, 2007, at 9:51 AM, Alexander Lamb (dev) wrote:
> But what you are saying is DataContext has a null EntityResolver.
Yes, but I guess the first thing to check is whether my assumption
about this is true in your code [if(context.getEntityResolver() ==
null) { ... }].
> This could come from deserializing a DataContext.
Potentially, although in most cases it works, but see my last comment
below - I think another reason is more likely.
> What else could make the DataContext loose the EntityResolver? Is
> there one EntityResolver per DataContext or per Entity?
There's one shared by all contexts (it belongs to a DataDomain).
> The DataContext is simply created doing a new DataContext().
That is probably the reason. This constructor creates a DataContext
that is not attached to Cayenne stack (as its JavaDoc comment
states). I would recommend using a static factory method that
properly connects the context:
DataContext context = DataContext.createDataContext();
Or if you instantiate Cayenne Configuration yourself instead of using
the default singleton, check the source of 'createDataContext' and
create the instantiation method that uses your own configuration
instance.
Cheers,
Andrus
This archive was generated by hypermail 2.0.0 : Sat Sep 01 2007 - 03:03:59 EDT