Hi Olli

Actually I would have thought the OP expectations of collections to be fair.


If OJB is meant to provide the persistence mechanism for my application so
that I can then just code against Objects, why shouldn't I expect to be able
to persist an Object that holds a collection of other Objects (1->n) and
have the state of my Object reflected in the persistence operation without
micro-managing the 'n' side of the relationship?

It seems that the original persistence of the Object supports our
expectations but subsequent operations do not.

I can create my original object with it's collection of 'n' objects and
simply say persist and it is done.  It even sets the foreign key attribute
held in the 'n' object for me.

But then to add and remove 'n' objects I need to persist or un-persist each
object as well as set the foreign key attribute on any new 'n' objects
before persisting them.

For me this does not seem consistent.  But a lot of this is new so I would
welcome advice/comments that would help me understand why this is the way it
is.

Cheers
Shane



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 17 June 2003 12:21 a.m.
To: [EMAIL PROTECTED]
Subject: RE: how to update a collection reference

Hello,

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> 
> I have an object A that have a collection reference to a list 
> of objects B.
> 
> Is anyone that could help me to understand how can I update 
> the collection reference of the object A?

It should be updated automatically when you update A.
Besides, you might have to update the respective objects, 
you have added/removed.

> My problem is that the objects B I remove from the list of 
> objects B are not deleted in the database when I update the object A.

Why would you expect that to happen? When you wish to delete an
item b from the database, you have to explicitly delete it with the
suitable API call, e.g.
        broker.delete(x);  // PersistenceBroker
or
        database.deletePersistent(x);  // ODMG

HTH,
        Olli


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

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

Reply via email to