AEM-6.4 SQL2 query is not working from backend | Community
Skip to main content
vijays80591732
New Participant
May 3, 2019
Solved

AEM-6.4 SQL2 query is not working from backend

  • May 3, 2019
  • 12 replies
  • 8007 views

Hi All,

I'm using an sql2 query to fetch all the home pages from different locales based on sling:resourceType and my query is below. I'm using system user to get the resolver. FYI.

SELECT * FROM [cq:Page] AS s WHERE s.[jcr:content/sling:resourceType] = 'sample/components/structure/pageHome' AND ISDESCENDANTNODE('/content/sample')

The above query is working fine in my local . But in Development environment I'm unable to fetch the home pages using this query from backend, whereas the same query I tried with crx/de query search where I'm able to fetch the homepages.  I tried the below things but no luck,

Checked the system user permissions in user admin (which I used to get the resolver) and I'm having read, modify, delete, readACL, editACL for all .

Checked the backend logs. After executing the above query from backend I'm getting zero results. So, suspecting it should be permission issue. Can anyone help me to fix this?

Arun Patidarsmacdonald2008Ratna Kumar

Regards,

Vijay

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vijays80591732

Hi All,

Thank you very much for your inputs. The has been fixed and it was due to the permission issue which I given for service user.

Regards,

Vijay

12 replies

smacdonald2008
New Participant
May 3, 2019

Are you seeing any error message - if everything is setup the same way - it will work.

arunpatidar
New Participant
May 3, 2019

Hi,

How did you get the session, the session should be repository session.

@Reference
private SlingRepository repository;

session = repository.loginService("readService",null);

final Query query=session.getWorkspace().getQueryManager().createQuery("yourquery",Query.JCR_SQL2);

Arun Patidar