}
FeatureSet featureSet = context.getSupportedFeatureSet();
AbstractSession clientSession = context.getClientSession(em);
if (featureSet.isSupported(Feature.PAGING)) {
PageableFieldValidator validator = new PageableFieldValidator(entity.getClass(), attribute, uriInfo);
if (validator.isFeatureApplicable()) {
query.setMaxRows(validator.getLimit());
query.setFirstResult(validator.getOffset());
// We need to add limit and offset to query parameters because request builder reads it from there
Map<String, Object> queryParams = getQueryParameters(uriInfo);
queryParams.put(QueryParameters.JPARS_PAGING_LIMIT, String.valueOf(validator.getLimit()));
queryParams.put(QueryParameters.JPARS_PAGING_OFFSET, String.valueOf(validator.getOffset()));
// check orderBy, and generate a warning if there is none
checkOrderBy(query);
Object result = clientSession.executeQuery(query, descriptor.getObjectBuilder().buildRow(entity, clientSession, WriteType.INSERT));