Changed the way to query worklogs to reduce the size of the sql query

Use plain sql to query worklogs instead of the API method, With this the issue id's does not appear in the generated sql query.