/** * Gets current query or constructs one on demand. * * @return The current query. */ private Query getQuery() { if (query == null) { query = queryFactory.constructQuery(sortPropertyIds, ascendingStates); queryCount++; } return query; }