willConnect() works fine for connecting A (which is registered) to B
(which is not registered) but I think you need something like
willDisconnect() for removing B (which is unregistered) from A (which is
registered).
Gili
Andrus Adamchik wrote:
> 1.2 has CayenneDataObject.willConnect that is supposed to suck an
> object in a DataContext when establishing relationship with another
> registered object. So if at least one of the objects is registered, and
> an exception is thrown - this is a bug. If no objects are registered,
> this is expected.
>
> Andrus
>
>
> On Sep 9, 2005, at 2:03 PM, 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/
>>
>>
>
>
-- http://www.desktopbeautifier.com/
This archive was generated by hypermail 2.0.0 : Fri Sep 09 2005 - 14:12:10 EDT