Question about addNode and session.save()

View: New views
4 Messages — Rating Filter:   Alert me  

Question about addNode and session.save()

by Anton Gavazuk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

tiny question

i have code like this:

Node a = getBlaBlaBla();
Node b  = a.addNode("nodeB");
Node c = b.addNode("nodeC");
session.save();

And I recognized that nodeB has been stored but nodeC is not stored.
According to JCR docs all changes in which have been made in
particular session must be stored in a storage...
What is wrong?

Some env info:
Jackrabbit 1.4 used through JCA adapter in Jboss.

Many thanks.

Re: Question about addNode and session.save()

by Alexander Klimetschek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you get any exceptions? This code should retrieve the persisted nodes:

Node a = session.getRootNode().getNode("path/to/a");
Node b = a.getNode("nodeB");
Node c = a.getNode("nodeB/nodeC"); // or b.getNode("nodeC");


Regards,
Alex

On Fri, Jul 11, 2008 at 9:32 AM, Anton Gavazuk <antongavazuk@...> wrote:

> Hi folks,
>
> tiny question
>
> i have code like this:
>
> Node a = getBlaBlaBla();
> Node b  = a.addNode("nodeB");
> Node c = b.addNode("nodeC");
> session.save();
>
> And I recognized that nodeB has been stored but nodeC is not stored.
> According to JCR docs all changes in which have been made in
> particular session must be stored in a storage...
> What is wrong?
>
> Some env info:
> Jackrabbit 1.4 used through JCA adapter in Jboss.
>
> Many thanks.
>



--
Alexander Klimetschek
alexander.klimetschek@...

Re: Question about addNode and session.save()

by Anton Gavazuk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes, thats it - I got exception  when I trying to access the nodeC

that is the way how I recognized that nodeC is not being stored.

2008/7/11 Alexander Klimetschek <aklimets@...>:

> Do you get any exceptions? This code should retrieve the persisted nodes:
>
> Node a = session.getRootNode().getNode("path/to/a");
> Node b = a.getNode("nodeB");
> Node c = a.getNode("nodeB/nodeC"); // or b.getNode("nodeC");
>
>
> Regards,
> Alex
>
> On Fri, Jul 11, 2008 at 9:32 AM, Anton Gavazuk <antongavazuk@...> wrote:
>> Hi folks,
>>
>> tiny question
>>
>> i have code like this:
>>
>> Node a = getBlaBlaBla();
>> Node b  = a.addNode("nodeB");
>> Node c = b.addNode("nodeC");
>> session.save();
>>
>> And I recognized that nodeB has been stored but nodeC is not stored.
>> According to JCR docs all changes in which have been made in
>> particular session must be stored in a storage...
>> What is wrong?
>>
>> Some env info:
>> Jackrabbit 1.4 used through JCA adapter in Jboss.
>>
>> Many thanks.
>>
>
>
>
> --
> Alexander Klimetschek
> alexander.klimetschek@...
>

Re: Question about addNode and session.save()

by Alexander Klimetschek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could you elaborate more on the exact exception and the code you are
using (often it is in a place you don't expect)?

Regards,
Alex

On Fri, Jul 11, 2008 at 11:40 AM, Anton Gavazuk <antongavazuk@...> wrote:

> yes, thats it - I got exception  when I trying to access the nodeC
>
> that is the way how I recognized that nodeC is not being stored.
>
> 2008/7/11 Alexander Klimetschek <aklimets@...>:
>> Do you get any exceptions? This code should retrieve the persisted nodes:
>>
>> Node a = session.getRootNode().getNode("path/to/a");
>> Node b = a.getNode("nodeB");
>> Node c = a.getNode("nodeB/nodeC"); // or b.getNode("nodeC");
>>
>>
>> Regards,
>> Alex
>>
>> On Fri, Jul 11, 2008 at 9:32 AM, Anton Gavazuk <antongavazuk@...> wrote:
>>> Hi folks,
>>>
>>> tiny question
>>>
>>> i have code like this:
>>>
>>> Node a = getBlaBlaBla();
>>> Node b  = a.addNode("nodeB");
>>> Node c = b.addNode("nodeC");
>>> session.save();
>>>
>>> And I recognized that nodeB has been stored but nodeC is not stored.
>>> According to JCR docs all changes in which have been made in
>>> particular session must be stored in a storage...
>>> What is wrong?
>>>
>>> Some env info:
>>> Jackrabbit 1.4 used through JCA adapter in Jboss.
>>>
>>> Many thanks.
>>>
>>
>>
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetschek@...
>>
>



--
Alexander Klimetschek
alexander.klimetschek@...
LightInTheBox - Buy quality products at wholesale price