jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Holeczek <flor...@holeczek.de>
Subject Re: newb transient repository questions
Date Mon, 21 Jul 2008 07:20:59 GMT
Hallo Marcel,

are you sure about this? I thought Michael's code produced the
following tree:

      root
       |
     assets
    /      \
asset[1] asset[2]

Regards,
 Florian

Urspr√ľngliche Nachricht vom 21.07.2008 um 09:07:
> Hi Michael,

> Michael Harris wrote:
>> another noob question.  I have the following codes
>> 
>>                 Node root = session.getRootNode();
>>                 Node assets = root.addNode("assets");
>> 
>>                 // Store content
>>                 Node asset = assets.addNode("asset");
>>                 asset.setProperty("url", "http://asset1url.org");
>>                 asset.setProperty("name", "Asset 1");
>>                 asset.setProperty("typetype", "image");
>> 
>>                 Node asset2 = assets.addNode("asset");

> this creates a same named sibling /asset[2]

>>                 asset2.setProperty("url", "http://asset2url.org");
>>                 asset2.setProperty("name", "Asset 2");
>>                 asset2.setProperty("type", "image");
>>                 session.save();
>> 
>> and then
>> 
>>         Node root = session.getRootNode();
>>         Node assets = root.getNode("assets");

> this will only return the first asset node but not the second one.

>>         assets.remove();
>>         session.save();
>> 
>> the more I run the test, the more nodes I get.  Seems like the data in the
>> TransientRepo is being stored on the disk.  The remove is not cleaning it
>> up.  For why?

> to remove all asset nodes you need to do the following:

> for (NodeIterator assets = root.getNodes("assets"); assets.hasNext(); ) {
>      assets.nextNode().remove();
> }
> session.save();

> regards
>   marcel


Mime
View raw message