It doesn't look like child DataContexts properly restore from serialization.
They end up in a state without an EntityResolver because channel is
non-null and lazyInitParentDomainName is null.

Before serialization:
===========================
channel= DataContext  (id=4110)
entityResolver= EntityResolver  (id=89)
lazyInitParentDomainName= null
mergeHandler= DataContextMergeHandler  (id=4111)
objectStore= ObjectStore  (id=4112)
===========================

After serialization:
===========================
channel= DataContext  (id=4162)
entityResolver= null
lazyInitParentDomainName= null
mergeHandler= null
objectStore= ObjectStore  (id=4163)
===========================

   public EntityResolver getEntityResolver() {
       awakeFromDeserialization();
       return entityResolver;
   }

   // Re-attaches itself to the parent domain with previously stored name.
   //
   // TODO: Andrus 11/7/2005 - this is one of the places where Cayenne
   // serialization relies on shared config... This is bad. We need some
   // sort of thread-local solution that would allow to use an
alternative configuration.
   //
   private final void awakeFromDeserialization() {
       if (channel == null && lazyInitParentDomainName != null) {

           // call a setter to ensure EntityResolver is extracted from channel
           setChannel(Configuration.getSharedConfiguration().getDomain(
                   lazyInitParentDomainName));
       }
   }

Reply via email to