Re: "Cannot commit changes - channel is not set." after regular DataContext serialization

From: Mike Kienenberger (mkienen..mail.com)
Date: Mon May 22 2006 - 20:52:30 EDT

  • Next message: Andrus Adamchik: "Re: "Cannot commit changes - channel is not set." after regular DataContext serialization"

    On 5/22/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > I can imagine that a child context won't reattach to stack properly
    > on deserialization (should probably document this as a known
    > limitation ... or rather something left to the user to take care of).
    > Top level DC however should be able to attach to default DataDomain
    > transparently. Do you have more than one DD ?

    No. Lots of DataMaps, but only one DataDomain.

    I create like this:

    threadDataContext().createDataContext()

    And I am explicitly serializing it as follows in another object that
    has no other serializable attributes. I got around the problem by
    using setChannel at this point. Note that this is not really a
    childDataContext at this point.

            private void writeObject(java.io.ObjectOutputStream out)
    throws IOException
            {
                out.writeObject(this.childDataContext);
            }
            private void readObject(java.io.ObjectInputStream in) throws
    IOException, ClassNotFoundException
            {
                this.childDataContext = (DataContext)in.readObject();
                childDataContext.setChannel(super.threadDataContext().getParentDataDomain());
                this.childDataContext.setUserProperty("temporary", Boolean.TRUE);
            }

    Seems like every time I work around one issue, two more pop up. I'm
    currently having an object in my temporary data context with
    relationships to objects in my session-scoped data context. That's
    not normal, is it? This particular problem might be caused by how I
    was doing my serialization of DataObjects in the session-scoped data
    context (that context is not serialized, only the objects are).



    This archive was generated by hypermail 2.0.0 : Mon May 22 2006 - 20:52:54 EDT