Cayenne
  1. Cayenne
  2. CAY-553

Top-level DataContext fails to attach to default DataDomain transparently on deserialization

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2 branch
    • Fix Version/s: None
    • Component/s: Core Library
    • Labels:
      None

      Description

      Top-level DataContext fails to attach to default DataDomain transparently on deserialization.

      Caused by: org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2B2
      April 17 2006] Cannot commit changes - channel is not set.
      at org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:1186)
      at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1121)

      Data context is created with:

      DataContext.getThreadDataContext().createDataContext()

      Data context is serialized with:

      private void writeObject(java.io.ObjectOutputStream out) throws IOException

      { out.writeObject(this.childDataContext); }

      Data context is deserialized with:

      private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException

      { this.childDataContext = (DataContext)in.readObject(); // childDataContext.setChannel(super.threadDataContext().getParentDataDomain()); }

      Problem goes away if setChannel line is uncommented.

        Activity

        Mike Kienenberger created issue -
        Hide
        Andrus Adamchik added a comment -

        Hmm... this one doesn't look like a top one - it was created via "DataContext.getThreadDataContext().createDataContext() ", so it has a serialization limitation of a child context.

        Show
        Andrus Adamchik added a comment - Hmm... this one doesn't look like a top one - it was created via "DataContext.getThreadDataContext().createDataContext() ", so it has a serialization limitation of a child context.
        Hide
        Mike Kienenberger added a comment -

        Well, I admit I only used this particular form because I was lazy and in a hurry, but Eclipse resolves it as

        public static DataContext createDataContext()

        { return Configuration.getSharedConfiguration().getDomain().createDataContext(); }

        That seems like a top-level DataContext constructor, but maybe Eclipse is confused.

        Show
        Mike Kienenberger added a comment - Well, I admit I only used this particular form because I was lazy and in a hurry, but Eclipse resolves it as public static DataContext createDataContext() { return Configuration.getSharedConfiguration().getDomain().createDataContext(); } That seems like a top-level DataContext constructor, but maybe Eclipse is confused.
        Hide
        Andrus Adamchik added a comment -

        Sorry, long day... You are right - this is a static method that creates a top-level DC.

        Show
        Andrus Adamchik added a comment - Sorry, long day... You are right - this is a static method that creates a top-level DC.
        Hide
        Mike Kienenberger added a comment -

        Either that, or we're using different meanings for "top-level DC".

        I'm taking top-level DC to mean not a child (nested) DataContext, but perhaps you mean something else.

        Show
        Mike Kienenberger added a comment - Either that, or we're using different meanings for "top-level DC". I'm taking top-level DC to mean not a child (nested) DataContext, but perhaps you mean something else.
        Hide
        Mike Kienenberger added a comment -

        Changed DataContext.getThreadDataContext().createDataContext() to DataContext.createDataContext() and verified that the channel still isn't attached on deserialization.

        Show
        Mike Kienenberger added a comment - Changed DataContext.getThreadDataContext().createDataContext() to DataContext.createDataContext() and verified that the channel still isn't attached on deserialization.
        Henri Yandell made changes -
        Field Original Value New Value
        Project Import Sat Mar 21 00:51:04 PDT 2009 [ 1237621864637 ]
        Ari Maniatis made changes -
        Workflow jira [ 12456341 ] Cayenne workflow [ 12487089 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Mike Kienenberger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development