CayenneDataObject#setDataContext()

From: Kevin Menard (kmenar..ervprise.com)
Date: Wed Sep 14 2005 - 00:06:21 EDT

  • Next message: Tore Halset: "Re: 3T Relationships [are done]"

    Hi all,

    Is there any reason why the aforementioned method does not register
    the CDO with the DC? I mean, is there any point in calling
    setDataContext() with a DC that you don't want the CDO registered with?

    I just spent a few hours debugging a problem where setDataContext()
    was called with a valid DC. This seemed to satisfy a lot of things
    in Cayenne, presumably because it just does a simple DC check.
    However, BatchQueryUtils#buildSnapshotForInsert() which calls
    getObjectId() on this CDO. Of course, the objectId is null, which
    causes Cayenne to crap out.

    So, anyway, something here seems inconsistent.

    If this is in fact the way it's intended to work for whatever reason,
    I'll simply open up an RFE for better exception handling in this
    case. Without having the source available, it's really hard to
    decipher what went wrong. A simple ("NPE: objectId is null in
    object" + relname) would have gone a long way in this case.

    -- 
    Kevin
    



    This archive was generated by hypermail 2.0.0 : Wed Sep 14 2005 - 00:06:37 EDT