Hi all,
I have downloaded jackrabbit-1.0-rc3 and tested with my application.
Almost everything works fine but i have discovered a problem with
jcr:deref queries (yes I am "jcr:deref-boy" :- )).
In my application there are several nodes that have a reference property
to a version of a particular node (actually a reference to
jcr:frozenNode). Prior to 1.0-rc3 version works fine, but with the last
release a query searching for this nodes returns 0 results.
I don't know if it is correct to use references to nodes in the
version workspace or it is a problem of the Query Manager.
I have tested it with version 0.9-rc1-incubating and with some
house-made versions and it worked well.
Here is a a JUnit method that tests this issue:
public void testVersionDerefSearch() throws Exception {
Session currentSession = JCRUtil.currentSession();
Node myRootNode = currentSession.getRootNode().addNode("root");
currentSession.save();
try {
Node referenced = myRootNode.addNode("referenced");
referenced.addMixin("mix:versionable");
currentSession.save();
Version version = referenced.checkin();
Node referencedVersionNode = version.getNode("jcr:frozenNode");
Value referenceValue =
currentSession.getValueFactory().createValue(referencedVersionNode);
Node referencer = myRootNode.addNode("referencer");
referencer.setProperty("aReference",referenceValue);
currentSession.save();
String
query="/"+myRootNode.getPath()+"/[EMAIL PROTECTED]/jcr:deref(@aReference,'*')";
QueryManager qm =
currentSession.getWorkspace().getQueryManager();
Query q = qm.createQuery(query, Query.XPATH);
QueryResult qr = q.execute();
NodeIterator ni = qr.getNodes();
assertEquals("Must find one result in query",1,ni.getSize());
while (ni.hasNext()) {
Node node = (Node) ni.next();
assertTrue(node.getProperty("jcr:frozenUuid").getString().equals(referenced.getUUID()));
}
} finally {
myRootNode.remove();
}
}
Regards,
Alvaro