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

From: Mike Kienenberger (mkienen..mail.com)
Date: Mon May 22 2006 - 21:35:53 EDT

  • Next message: Andrus Adamchik: "Re: more moderators?"

    On 5/22/06, Mike Kienenberger <mkienen..mail.com> wrote:
    > 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).

    Yeah, it's looking like this one was a self-inflicted problem.

    I threw in some extra code in my base DataObject:

        private void writeObject(java.io.ObjectOutputStream out)
        throws IOException
        {
            out.writeBoolean(Boolean.TRUE ==
    this.getDataContext().getUserProperty("temporary"));
            out.defaultWriteObject();
        }
        private void readObject(java.io.ObjectInputStream in)
        throws IOException, ClassNotFoundException
        {
            boolean isInTemporaryDataContext = in.readBoolean();
            in.defaultReadObject();
            this.isInTemporaryDataContext = isInTemporaryDataContext;
        }

    and then conditionally attach to the thread-bound datacontext only if
    isInTemporaryDataContext is false, and that appears to have solved
    this problem.



    This archive was generated by hypermail 2.0.0 : Mon May 22 2006 - 21:36:17 EDT