Thks Armin I 'll try that .
But in the documentation on a M-To-N relation or 1-N relation.
When we are using auto-update = false ( aka link ) and auto-delete=false (
aka link ) .The referenced objects should not be updated nor inserted. 
But instances could be delete. It seems to be a bit weird to me. May be add
a line in the Documentation for completing it depending of the kind of
collections ???


Anyway thanks a lot for your support :)


Thierry 


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 01, 2004 9:30 PM
To: OJB Users List
Subject: Re: Help M-To-N relation update => deletion of referenced objects .


Hi Thierry,

by default OJB use a removal aware collection, but in your case you 
shouldn't use it. Thus you only need to declare the collection within 
your collection-descriptor:

<collection-descriptor
name="favoriteFood"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList
"
element-class-ref="org.apache.ojb.broker.InterfaceFood"
auto-retrieve="true"
auto-update="true"
indirection-table="GOURMET_FOOD"
 >
          <fk-pointing-to-this-class column="GOURMET_ID"/>
          <fk-pointing-to-element-class column="FOOD_ID"/>
</collection-descriptor>

regards,
Armin

Thierry Hanot wrote:

> I've just tried with the last cvs version . I still have the problem .
> It seem's that the removalAware Collections should not delete objects if
the
> related collection is not in auto-delete="true" or auto-update="true" . 
> Is somebody could help me with this ?????
> 
> B.R
> 
> Thierry
> 
> 
> -----Original Message-----
> From: Thierry Hanot [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 01, 2004 7:52 PM
> To: [EMAIL PROTECTED]
> Subject: Help M-To-N relation update => deletion of referenced objects .
> 
> 
> Hello  all
>  
> I have a big pbm ...
>  
> I'm using a M-TO-N relation something like:
> 
> <collection-descriptor
>      name="persons"
>  
> collection-class="org.apache.ojb.broker.util.collections.ManageableArr
> ayList
> "
>      element-class-ref="org.apache.ojb.broker.Person"
>      auto-retrieve="true"
>      auto-update="false"
>     auto-delete="false"
>      indirection-table="PERSON_PROJECT"
>   >
>      <fk-pointing-to-this-class column="PROJECT_ID"/>
>      <fk-pointing-to-element-class column="PERSON_ID"/>
> </collection-descriptor>
>  
>  
>  
> My problem is when i update a project after removing some reference on 
> some personne the personne are deleted.
>  
> After looking in obj internally , i see that ojb use a 
> RemovalAwareCollection for keeping the personnes list in the projet. 
> After the collection update ( in storeCollection ) the PB call the 
> method afterStore in the RemovalAwareCollection . This method call 
> delete on the removed elements ( the referenced elements not the links 
> ... ) .
>  
> I tried to used a proxy ,  i still have the problem .
>  
> In fact i have the problem on all collection in my repository ( the 
> auto-delete='false' does not work also when updating objects ).
>  
>  
>  
> Is somebody could help me ?
> May be the Armin's patch is enough , i 'll test it .
>  
>  
> B.R
>  
>  
> Thierry
>  
>  
>  
>  
> 
> 
> ---------------------------------------------------------------------
> 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]

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

Reply via email to