Unsaved Changes not visible to xpath queries

2 messages Options
Embed this post
Permalink
mericet

Unsaved Changes not visible to xpath queries

Reply Threaded More More options
Print post
Permalink
When I make changes to a Jackrabbit JCR repository using node.addNode(), I can retrieve the newly created node with node.getNode(), or session.getItem().

But when I use an XPath query to retrieve the node, it fails to find it until I save the session. The only xpath query to find it is the simple 'return everything' query //*
but that's not very useful.

any ideas/suggestions will be welcome
thanks

Marcel Reutegger

Re: Unsaved Changes not visible to xpath queries

Reply Threaded More More options
Print post
Permalink
Hi,

On Fri, Jul 3, 2009 at 14:58, mericet<[hidden email]> wrote:
> When I make changes to a Jackrabbit JCR repository using node.addNode(), I
> can retrieve the newly created node with node.getNode(), or
> session.getItem().
>
> But when I use an XPath query to retrieve the node, it fails to find it
> until I save the session.

that's the behaviour that is specified in JSR 170. a query is executed
only against persisted (saved & committed) nodes.

JSR 283 is more open and allows an implementation to also take saved
but uncommitted changes into account or even transient changes that
are not yet saved.

Jackrabbit currently does not implement any of the above.

> The only xpath query to find it is the simple
> 'return everything' query //*
> but that's not very useful.

yeah, that's a special case. instead of actually executing a 'query'
it simply returns an iterator that walks the workspace tree. that also
includes transient changes.

> any ideas/suggestions will be welcome

create a JIRA issue and submit a patch :)

regards
 marcel