You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ge...@lex-com.net on 2003/08/18 10:06:46 UTC
How to avoid 'RemovalAwareCollection' in 1:N mappings
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
Re: How to avoid 'RemovalAwareCollection' in 1:N mappings
Posted by jg...@renr.es.
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org