Hi All,
I am getting NullPointerException at --> Query query = builder.createQuery(PredicateGroup.create(map), session);
I have used -->
@Reference
private QueryBuilder builder ; before (Outside) activate method.
Code Snip:::
Map<String, Object> map = new HashMap<String, Object>();
map.put("type", "cq:Page");
map.put("path", roothPath);
map.put("1_property", "=@jcr:content/someprop");
map.put("1_property.value", "somevalue");
map.put("1_property.operation", "like");
map.put("orderby", "@jcr:content/jcr:lastmodified");
map.put("orderby.sort", "desc");
map.put("p.limit", "-1");
Query query = builder.createQuery(PredicateGroup.create(map), session);
SearchResult result = query.getResult();
Can anyone suggest where am i missing this.
Thanks,
Raghava.
Solved! Go to Solution.
Views
Replies
Total Likes
Got My Mistake,
@Override
public void activate() throws Exception {
resolver = getResourceResolver();
session = resolver.adaptTo(Session.class);
builder = getSlingScriptHelper().getService(QueryBuilder.class); instead of reference
}
Views
Replies
Total Likes
Got My Mistake,
@Override
public void activate() throws Exception {
resolver = getResourceResolver();
session = resolver.adaptTo(Session.class);
builder = getSlingScriptHelper().getService(QueryBuilder.class); instead of reference
}
Views
Replies
Total Likes
Other possibility is to use Sling-Models, then you can use the @Inject annotation.
Views
Replies
Total Likes