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 Klaus Ripplinger <kl...@mannheimer.de> on 2004/03/03 18:18:20 UTC

delete relation in indirection-table

Hi,

my problem: how to delete a relation when using "Non-Decomposed m:n Mapping". 
After removing an object from a collection (RemovalAwareCollection) and 
saving the object
(PersistenceBrokerFactory.defaultPersistenceBroker().store(Object o)) not only
the relation is deleted but also the ralated object, i.e. the one 
that has been removed from the collection. Can this be avoided? F.e. i don't
want to delete a 'project' when removing a 'project' from 'user'. Only the entry
in the 
indirection-table that mapps projects to users should be deleted.     

Regards 
Klaus

collection xml:
...
<collection-descriptor
   name="projects"
   collection-class=
      "org.apache.ojb.broker.util.collections.RemovalAwareCollection"
   element-class-ref="com.imd.paris.base.Projects"
   indirection-table="user_projects"
   auto-delete="false"
   auto-update="true">
   <fk-pointing-to-this-class column="user_id"/>
   <fk-pointing-to-element-class column="project_id"/>
</collection-descriptor>
...
 


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


Re: delete relation in indirection-table

Posted by Armin Waibel <ar...@apache.org>.
Hi all,

is this behaviour documented?

regards,
Armin

Klaus Ripplinger wrote:
> Hi Olivier, Hi Edson,
> 
> using MangeableVector solved the problem!
> thanks a lot!
> 
> Klaus
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: delete relation in indirection-table

Posted by Klaus Ripplinger <kl...@mannheimer.de>.
Hi Olivier, Hi Edson,

using MangeableVector solved the problem!
thanks a lot!

Klaus



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


Re: delete relation in indirection-table

Posted by "olivier.nouguier" <ol...@wanadoo.fr>.
Hi, I had the same problem which I resolved by replacing the ...Removal
AwareCollection by
"org.apache.ojb.broker.util.collections.ManageableVector"

Don't known if it a good solution, but it's seem to work fine...

Le mer 03/03/2004 à 18:18, Klaus Ripplinger a écrit :
> Hi,
> 
> my problem: how to delete a relation when using "Non-Decomposed m:n Mapping". 
> After removing an object from a collection (RemovalAwareCollection) and 
> saving the object
> (PersistenceBrokerFactory.defaultPersistenceBroker().store(Object o)) not only
> the relation is deleted but also the ralated object, i.e. the one 
> that has been removed from the collection. Can this be avoided? F.e. i don't
> want to delete a 'project' when removing a 'project' from 'user'. Only the entry
> in the 
> indirection-table that mapps projects to users should be deleted.     
> 
> Regards 
> Klaus
> 
> collection xml:
> ...
> <collection-descriptor
>    name="projects"
>    collection-class=
>       "org.apache.ojb.broker.util.collections.RemovalAwareCollection"
>    element-class-ref="com.imd.paris.base.Projects"
>    indirection-table="user_projects"
>    auto-delete="false"
>    auto-update="true">
>    <fk-pointing-to-this-class column="user_id"/>
>    <fk-pointing-to-element-class column="project_id"/>
> </collection-descriptor>
> ...
>  
> 
> 
> ---------------------------------------------------------------------
> 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


Re: delete relation in indirection-table

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
Ops, my mistake. I use RemovalAware... in 1:N relations.
As stated by Olivier, you must NOT use RemovalAwareCollection - use ManageableCollection.

Best regards,

Edson Richter
  ----- Original Message ----- 
  From: Edson Carlos Ericksson Richter 
  To: 'OJB Users List' 
  Sent: Wednesday, March 03, 2004 2:39 PM
  Subject: Re: delete relation in indirection-table


  I use exactly same config and works as expected, except I use proxies.

  There is any chance you be issueing a delete(Object o2), that is deleting the "n" related object?

  I'm using either rc4 and rc5 (latest from CVS). What version are you using? Are you using proxies?

  Edson Richter

    ----- Original Message ----- 
    From: Klaus Ripplinger 
    To: ojb-user@db.apache.org 
    Sent: Wednesday, March 03, 2004 2:18 PM
    Subject: delete relation in indirection-table


    Hi,

    my problem: how to delete a relation when using "Non-Decomposed m:n Mapping". 
    After removing an object from a collection (RemovalAwareCollection) and 
    saving the object
    (PersistenceBrokerFactory.defaultPersistenceBroker().store(Object o)) not only
    the relation is deleted but also the ralated object, i.e. the one 
    that has been removed from the collection. Can this be avoided? F.e. i don't
    want to delete a 'project' when removing a 'project' from 'user'. Only the entry
    in the 
    indirection-table that mapps projects to users should be deleted.     

    Regards 
    Klaus

    collection xml:
    ...
    <collection-descriptor
       name="projects"
       collection-class=
          "org.apache.ojb.broker.util.collections.RemovalAwareCollection"
       element-class-ref="com.imd.paris.base.Projects"
       indirection-table="user_projects"
       auto-delete="false"
       auto-update="true">
       <fk-pointing-to-this-class column="user_id"/>
       <fk-pointing-to-element-class column="project_id"/>
    </collection-descriptor>
    ...
     


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



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.605 / Virus Database: 385 - Release Date: 1/3/2004


  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.605 / Virus Database: 385 - Release Date: 1/3/2004

Re: delete relation in indirection-table

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
I use exactly same config and works as expected, except I use proxies.

There is any chance you be issueing a delete(Object o2), that is deleting the "n" related object?

I'm using either rc4 and rc5 (latest from CVS). What version are you using? Are you using proxies?

Edson Richter

  ----- Original Message ----- 
  From: Klaus Ripplinger 
  To: ojb-user@db.apache.org 
  Sent: Wednesday, March 03, 2004 2:18 PM
  Subject: delete relation in indirection-table


  Hi,

  my problem: how to delete a relation when using "Non-Decomposed m:n Mapping". 
  After removing an object from a collection (RemovalAwareCollection) and 
  saving the object
  (PersistenceBrokerFactory.defaultPersistenceBroker().store(Object o)) not only
  the relation is deleted but also the ralated object, i.e. the one 
  that has been removed from the collection. Can this be avoided? F.e. i don't
  want to delete a 'project' when removing a 'project' from 'user'. Only the entry
  in the 
  indirection-table that mapps projects to users should be deleted.     

  Regards 
  Klaus

  collection xml:
  ...
  <collection-descriptor
     name="projects"
     collection-class=
        "org.apache.ojb.broker.util.collections.RemovalAwareCollection"
     element-class-ref="com.imd.paris.base.Projects"
     indirection-table="user_projects"
     auto-delete="false"
     auto-update="true">
     <fk-pointing-to-this-class column="user_id"/>
     <fk-pointing-to-element-class column="project_id"/>
  </collection-descriptor>
  ...
   


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



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.605 / Virus Database: 385 - Release Date: 1/3/2004