query.withParameter(usingThisAs, instanceManager.getInstance(entity));
List<ResultOf.Parameter> parameters = resultOfMethodMetadata.getParameters();
for (int i = 0; i < parameters.size(); i++) {
query.withParameter(parameters.get(i).value(), args[i]);
}
Query.Result<?> result = query.execute();
if (resultOfMethodMetadata.isSingleResult()) {
return result.hasResult() ? result.getSingleResult() : null;
}
return result;
}