Querying worklogs in pages in Jira Server

Hi,

I’ve been advised very useful way to query Jira worklogs using OfBizDelegator findListIteratorByCondition in pages, however I can’t make it work, could someone please help?

I get the following error:

The SQL SELECT ID, issueid, AUTHOR, grouplevel, rolelevel, worklogbody, CREATED, UPDATEAUTHOR, UPDATED, STARTDATE, timeworked FROM PUBLIC.worklog WHERE (STARTDATE >= ? ) AND (STARTDATE < ? ) is invalid it does not have an ORDER BY clause.

I have tried to specify Oder by filed ID as follows, but it does not help:

OfBizListIterator worklogIterator = ofBizDelegator.findListIteratorByCondition("Worklog",
entityCondition, null, null, Arrays.asList("ID"), options);

I have options defined as follows:

final EntityFindOptions options = new EntityFindOptions(true, EntityFindOptions.TYPE_FORWARD_ONLY,
EntityFindOptions.CONCUR_READ_ONLY, false, ConfigurationService.DEFAULT_WORKLOG_LIMIT);

Thank you.

I’ve figured it out, I was missing Arrays.asList(“ID”) in other place, at the end of the loop for next iteration.