You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Edgar Merino <do...@gmail.com> on 2008/11/28 09:07:02 UTC

Remove child nodes while iterating them

Hello,

    Thanks for the replies on previous messages. OCM is working fine, 
but I've noticed that when calling ObjectContentManager#remove(Object 
obj) it removes the node from the underlaying session, if this is done 
while iterating a collection I get a PathNotFoundException, since the 
path of the objects in the collection does not correspond to the actual 
paths of the nodes within the session. Is there anyway I can avoid this 
(without creating a Query)?

Thanks in advance,
Edgar Merino

Re: Remove child nodes while iterating them

Posted by Edgar Merino <do...@gmail.com>.
Never mind, removing them from the parent node and then updating it 
seems to be the way to go.

Edgar Merino





Edgar Merino escribió:
> Hello,
>
>    Thanks for the replies on previous messages. OCM is working fine, 
> but I've noticed that when calling ObjectContentManager#remove(Object 
> obj) it removes the node from the underlaying session, if this is done 
> while iterating a collection I get a PathNotFoundException, since the 
> path of the objects in the collection does not correspond to the 
> actual paths of the nodes within the session. Is there anyway I can 
> avoid this (without creating a Query)?
>
> Thanks in advance,
> Edgar Merino
>


Re: Remove child nodes while iterating them

Posted by Christophe Lombart <ch...@gmail.com>.
Hi Edgar,

Why do you mean by iterating a collection ? Are you iterating on a
collection attribute to remove some elements  or is it another use case ?
If you want to remove some elements in a collection attribute, why not to
set a refreshed collection into the attribute and make a save ?

Let me know if it is another use case.

br,
Christophe


On Fri, Nov 28, 2008 at 09:07, Edgar Merino <do...@gmail.com> wrote:

> Hello,
>
>   Thanks for the replies on previous messages. OCM is working fine, but
> I've noticed that when calling ObjectContentManager#remove(Object obj) it
> removes the node from the underlaying session, if this is done while
> iterating a collection I get a PathNotFoundException, since the path of the
> objects in the collection does not correspond to the actual paths of the
> nodes within the session. Is there anyway I can avoid this (without creating
> a Query)?
>
> Thanks in advance,
> Edgar Merino
>