AEM-6.4 SQL2 query is not working from backend | Community
Skip to main content
vijays80591732
Level 3
May 3, 2019 7:33 AM UTC
Solved

AEM-6.4 SQL2 query is not working from backend

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 Patidar​ smacdonald2008​ Ratna 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.
vijays80591732
vijays80591732Accepted solution
Level 3
May 7, 2019 8:33 AM UTC

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
Level 10
May 3, 2019 3:23 PM UTC

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

Translate
arunpatidar
New Participant
May 3, 2019 12:37 PM UTC

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);

Translate
Arun Patidar