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 Björn Voigt <bv...@hs-harz.de> on 2004/06/16 16:03:42 UTC

Autodelete of from a Collection removed Items

Hello Group,

I want to develope a form app with cocoon forms using ojb.
I have a 1:n business-model like ProductGroup - Articles  (one group has 
n article).

I am using the PB-Api and i have realized the 1:n
relation with a collection in ProductGroup.

CocoonForms allows me to bind the model to a form.
It is possible to describe a repeater, which shows the
Article-Items inside the collection. So I defined a binding between
an group and a form, a repeater shows all articles of a group.
The repeater allows to insert and delete new Articles from
the collection.

Ok now my problem, If I get a Group-Object from DB with
n Articles inside the collection, bind it to the form and remove
some of it from the collection, how can I autodelete it from the
article table, too? Is this possible with a one and only

broker.store(group)

How I have to define the mapping?


Thanks for your help

Björn Voigt


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Autodelete of from a Collection removed Items

Posted by Björn Voigt <bv...@hs-harz.de>.
Thank you Armin, this
works for me.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Autodelete of from a Collection removed Items

Posted by Armin Waibel <ar...@apache.org>.
Hi Björn,

Björn Voigt wrote:

> Hello Group,
> 
> I want to develope a form app with cocoon forms using ojb.
> I have a 1:n business-model like ProductGroup - Articles  (one group has 
> n article).
> 
> I am using the PB-Api and i have realized the 1:n
> relation with a collection in ProductGroup.
> 
> CocoonForms allows me to bind the model to a form.
> It is possible to describe a repeater, which shows the
> Article-Items inside the collection. So I defined a binding between
> an group and a form, a repeater shows all articles of a group.
> The repeater allows to insert and delete new Articles from
> the collection.
> 
> Ok now my problem, If I get a Group-Object from DB with
> n Articles inside the collection, bind it to the form and remove
> some of it from the collection, how can I autodelete it from the
> article table, too? Is this possible with a one and only
> 
> broker.store(group)
> 
> How I have to define the mapping?
> 

Define a 1:n mapping between ProductGroup and Article and use a 
RemovalAware collection-class in collection-descriptor (Currently it's 
used by default, so no need to specify).

Please see
http://db.apache.org/ojb/docu/basic-technique.html#Mapping+1%3An+associations

regards,
Armin

> 
> Thanks for your help
> 
> Björn Voigt
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org