Hi Vincenz,

I have set up my object model so that A.addB(B) automatically calls
B.setA(A). This takes care of tracking addings without changing the
collection class.

For removals, there are two options: 

1) Stay with the default collection class (RemovalAwareCollection) and
just call A.remove(B). This will remove B from A's collection and
delete B from the database.

2) Use a ManagableVector as collection class and call B.setA(null) in
your A.removeB() method. This will persistently remove B from the
collection but the B object by itself remains persistent.

I use both options depending on the classes involved.

hth
Gerhard

On Tue, 28 Oct 2003 12:29:09 +0100, "Vincenz Braun" <[EMAIL PROTECTED]>
wrote:

>Hello,
>
>I have a simple 1:n relationship similar to the one
>in the documentation (both have auto-incremented 
>primary keys).
>
>I use the ODMG layer. With the default settings only
>removals are tracked (because af the RemovalAware collection).
>Changing auto-update to true leaves me with problems when 
>inserting new objects. Updating (adding and removing) is then 
>fine. But with ODMG I can not use this setting.
>
>Next I tried to use the Dlist as the collection class. 
>Here adding works but removals are not tracked. 
>
>I ended up with writing my own RemovalAndAddingAwareManagableCollection.
>Is this really necessary and why?
>
>Thanks,
>Vincenz Braun



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to