Problems with DataContext being null in object

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Mon Dec 18 2006 - 16:27:49 EST

  • Next message: Øyvind Harboe: "Re: Persistent properties in Tapestry & Cayenne => NPE sometimes"

    Under which circumstances can a Cayenne Data Object have it's Data
    Context set to null?

    I see 5 (five!) cases:

    - application invokes setDataContext(null)
    - Cayenne rolls back a new uncommitted object.
    - committed deleted object
    - serialize + deserialize
    - explicit invalidation/unregistering of objects

    a) is this list complete? I'm using Cayenne 1.2

    b) This makes me wonder whether the following construct is safe in
    *all* cases. Especially I'm a bit concerned about what happens when
    this is executed on a DataContext:

    try
    {
      context.commitChanges();
    }
    {
    // roll back after a successful commit is *supposed* to be a no-op, so we
    // execute this always for simplicity
    //
    // or is it?????
    context.rollbackChanges();
    }

    (The persistance="yes" thingy I wrote today is a real concern for our
    app, but not the culprit for my particular problems right now.)

    -- 
    Øyvind Harboe
    http://www.zylin.com
    



    This archive was generated by hypermail 2.0.0 : Mon Dec 18 2006 - 16:28:26 EST