Hi Jose,

Using a link table and a programatically controlled  M:N relation seems a 
reasonable approach. I'll try this out. Thanks for the tip.

Gerhard Grosse





<[EMAIL PROTECTED]>
18.08.2003 14:39
Bitte antworten an "OJB Users List"

 
        An:     <[EMAIL PROTECTED]>
        Kopie:  <[EMAIL PROTECTED]>
        Thema:  Re: How to avoid 'RemovalAwareCollection' in 1:N mappings


Hi Gerhard

It depens which is the relation 1:n. For example, invoice/lines_invoice, 
if
an invoice is delete, its lines child must be deleted too. I´ve used the
default collection (RemovalAwareCollection) in that relation (1:N)

In  other relation (person and role) I´ve used M:N relation, because a
person is able to change his role ( simple worker to the boss). I control
the M:N relation programatically to avoid one person has more than one
role. The collection is ManageableVector. I delete only the intermediate
table (PERSON_ROLE),

Jose Galiana

> Hi all,
>
> I can't seem to find a way to control how child objects are treated
> when  removed from the collection of a parent object in a 1:N mapping.
> By  default OJB (PB API) seems to delete the child object, regardless
> of the  auto-upated/delete setting in repository.xml, but there must be
> a way to  avoid this. Sometimes, the child object should continue to
> exist
> independently of the parent.
>
> I looked through some older messages in this mailing list, and it seems
> to  me that in earlier OJB versions the opposite was the case: The
> child  objects were not deleted when removed from the collection, and
> the only  way to make this happen was to explicitly use a
> RemovalAwareCollection in  the parent object to hold the child objects.
> Now it seems that OJB always  assigns a RemovalAwareCollection to my
> collection attributes. How can I  avoid this?
>
> Thanks,
> Gerhard Grosse




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



Reply via email to