Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3693688
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:24:24+00:00 2026-05-19T04:24:24+00:00

I am using Jackrabbit and I am trying to query for an existing node

  • 0

I am using Jackrabbit and I am trying to query for an existing node which has a UUID.
My code is shown below. The problem is that UUID for referenceNode is of the form “’90be246a-a17c-445e-a5ad-81b064de0bee'” and it seems that the XPATH engine used in Jackrabbit (Lucene) has problems dealing with hyphens.

If I run query2, everything is fine and referenceNode is printed.
If I run query1 (with the UUID) inside Eclipse, nothing is returned.
HOWEVER, if I run query1 inside Jackrabbit Viewer, the query runs fine.

It seems like I have to escape the hyphens in my queryString but I tried adding double-backslashes and I get the same result. What is the proper way to run queries against UUID’s?

  // Set up Nodes
  rootNode = session.getRootNode();

  Node referenceNode = rootNode.addNode("referenceNode");
  Node referencingNode = rootNode.addNode("referencingNode");

  referenceNode.addMixin("mix:referenceable");
  referencingNode.setProperty("pointer", new ReferenceValue(referenceNode));

  // Query
  String uuid = referenceNode.getUUID();
  QueryManager qm = ws.getQueryManager();

  String queryString1 = "//*[@jcr:uuid='"+uuid+"']";
  String queryString2 = "//referenceNode";

  Query q = qm.createQuery(queryString1, Query.XPATH);

  QueryResult result = q.execute();

  NodeIterator it = result.getNodes();

  while(it.hasNext()) {
   Node node = it.nextNode();
   System.out.println( node.getName());
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:24:24+00:00Added an answer on May 19, 2026 at 4:24 am

    The problem might be that the node is not saved yet. As written in the search documentation, “Node names and property values are indexed as soon as the data is saved or as soon as the transaction is committed.”

    In this case, I guess you could use Session.getNodeByIdentifier(String id) instead of using a query. It should be much faster as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using C#, I need a class called User that has a username, password, active
Is there a way that I can configure custom node types for Apache Jackrabbit
Using XSLT 1.0, I'm trying to essentially create a small node set and then
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I am using Jackrabbit with JCR, how can I change the order of the
Firstly, let me just say that I'm very new to JSR-170 and Jackrabbit/Lucene in
Using VB6 & Crystal Report 9. Need help with the VB6 code. When i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.