Re: Reverse relationships and registeration

From: Gili (cowwo..bs.darktech.org)
Date: Fri Sep 09 2005 - 14:07:54 EDT

  • Next message: Gili: "Re: Reverse relationships and registeration"

            I don't think so. B is transient.

            Basically what I am doing is...

    A exists
    create B
    A.setB(B);
    ... later on ...
    A = A.getCanonicalInstance()
    \-> This invokes B = B.getCanonicalInstance() and then A.setB(B)

            in other words... I associated B with A... then later on find out that
    an equivilent instance already exists in the DB so I try to remove the
    relationship to B and use the preexisting instance from the DB. That's
    where the exception gets thrown.

    Gili

    Gentry, Michael (Contractor) wrote:
    > Was B ever in A's DataContext?
    >
    > -----Original Message-----
    > From: Gili [mailto:cowwo..bs.darktech.org]
    > Sent: Friday, September 09, 2005 1:56 PM
    > To: cayenne-use..bjectstyle.org
    > Subject: Reverse relationships and registeration
    >
    >
    > Hi,
    >
    > I get a NullPointerException under the following situation
    >
    > A registers with the context
    > A.setRelationship(B) // where B is transient
    > A.setRelationship(C) // where C is commited
    >
    > now in the last step, Cayenne tries to undo the reverse
    > relationship
    > (CayenneDataObject.java line 376 eventually leading to line 461), but
    > because B is transient "dataContext" is null and an exception is thrown.
    >
    > I assume a workaround would be to explicitly initialize the
    > relationship object, but I just thought I should point this out because
    > I think Cayenne 1.2 is supposed to handle these sorts of things. Should
    > I file a JIRA issue for it?
    >
    > Gili

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 09 2005 - 14:07:55 EDT