jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Kabashnyuk" <ksmml...@gmail.com>
Subject Invalid combination of jcr:path clauses
Date Fri, 18 Apr 2008 10:22:44 GMT
Hi all.
How can we create an XPath or SQL query to retrieve two things in the JCR?
We can do :
select * from nt:base where jcr:path like '/test/live/%'

but can we do ?
select * from nt:base where
jcr:path like '/test/live/%'
or jcr:path like '/test/draft/%'

I have created a small test to check this issue.
And looks like it can't be done.
I check both 1.4 and 1.4.2



Node testRoot = superuser.getRootNode().addNode("test");

Node draftNode = testRoot.addNode("draft");
draftNode.addNode("sub1");
draftNode.addNode("sub2");

Node liveNode = testRoot.addNode("live");
Node c1 = liveNode.addNode("child1");
Node c2 = liveNode.addNode("child2");
superuser.save();

executeSqlQuery(superuser, " select * from nt:base "
+ " where jcr:path like '/test/live/%' or  jcr:path like '/test/draft/%'",  
new Node[] { c1,
c2 });

With

javax.jcr.query.InvalidQueryException: Invalid combination of jcr:path  
clauses
	at  
org.apache.jackrabbit.core.query.sql.JCRSQLQueryBuilder.createQuery(JCRSQLQueryBuilder.java:168)
	at  
org.apache.jackrabbit.core.query.sql.QueryBuilder.createQueryTree(QueryBuilder.java:39)
	at org.apache.jackrabbit.core.query.QueryParser.parse(QueryParser.java:57)
	at  
org.apache.jackrabbit.core.query.lucene.QueryImpl.<init>(QueryImpl.java:91)
	at  
org.apache.jackrabbit.core.query.lucene.SearchIndex.createExecutableQuery(SearchIndex.java:573)
	at org.apache.jackrabbit.core.query.QueryImpl.init(QueryImpl.java:127)
	at  
org.apache.jackrabbit.core.SearchManager.createQuery(SearchManager.java:295)
	at  
org.apache.jackrabbit.core.query.QueryManagerImpl.createQuery(QueryManagerImpl.java:94)
	at  
org.apache.jackrabbit.test.api.query.AbstractQueryTest.executeSqlQuery(AbstractQueryTest.java:264)

Thanks

Sergey Kabashnyuk
eXo Platform SAS

Mime
View raw message