This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
In trying to query the JCR from an OSGI bundle I am not getting any errors, just 0 returns.
The query I use is SELECT * FROM [cq:Page] WHERE ISDESCENDANTNODE('/content/***/en/recipes/all-recipes').
If I run the query tool in CRXDE lite I get back 174 results.
In my OSGI bundle I have code as follows
param.put(ResourceResolverFactory.SUBSERVICE, "readService"); ResourceResolver resolver = null; try { resolver = resolverFactory.getServiceResourceResolver(param); } catch (LoginException e) { e.printStackTrace(); } try { session = resolver.adaptTo(Session.class); } catch (Exception e) { e.printStackTrace(); } try { javax.jcr.query.QueryManager queryManager = session.getWorkspace().getQueryManager(); String sqlStatement = "SELECT * FROM [cq:Page] WHERE ISDESCENDANTNODE('/content/***/en/recipes/all-recipes')"; javax.jcr.query.Query query = queryManager.createQuery(sqlStatement, "JCR-SQL2"); javax.jcr.query.QueryResult result = query.execute(); javax.jcr.NodeIterator nodeIter = result.getNodes(); Long length = nodeIter.getSize(); if (length == 0) { return recipesList; } //length is always 0, I get no errors. while (nodeIter.hasNext()) { String row = ""; javax.jcr.Node node = nodeIter.nextNode(); row = node.getProperty("couponsCategory").getString(); recipesList.add(row); }
Regards
Clive Stewart
Solved! Go to Solution.
See this as an example:
https://helpx.adobe.com/experience-manager/using/java-swing-applications.html
Then once you know the code works - place it within an OSGi bundle.
Try setting up a Java desktop app and debug through the code. That is the nice part of the JCR API - you can run it from an Eclipse Java project and main method.
See this as an example:
https://helpx.adobe.com/experience-manager/using/java-swing-applications.html
Then once you know the code works - place it within an OSGi bundle.
smacdonald2008 wrote...
Try setting up a Java desktop app and debug through the code. That is the nice part of the JCR API - you can run it from an Eclipse Java project and main method.
Thank you Scott, your advice always clarifies to me what I need to do.
Regards
Clive Stewart
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies