} else {
jpqlContext = JPQLContext.createBuilder(contextType,
uriParserResultView).build();
}
JPQLStatement jpqlStatement = JPQLStatement.createBuilder(jpqlContext)
.build();
Map<String, String> customQueryOptions = uriParserResultView.getCustomQueryOptions();
String deltaToken = null;
if (customQueryOptions != null) {
deltaToken = uriParserResultView.getCustomQueryOptions().get("!deltatoken");
}
if (deltaToken != null) {
ODataJPATombstoneContext.setDeltaToken(deltaToken);
}
Query query = null;
List<Object> result = null;
JPAEdmMapping mapping = (JPAEdmMapping) uriParserResultView.getTargetEntitySet().getEntityType().getMapping();
ODataJPATombstoneEntityListener listener = null;
if (mapping.getODataJPATombstoneEntityListener() != null) {
listener = (ODataJPATombstoneEntityListener) mapping.getODataJPATombstoneEntityListener().newInstance();
query = listener.getQuery(uriParserResultView, em);
}
if (query == null) {
query = em.createQuery(jpqlStatement.toString());
if (listener != null) {
query.getResultList();
List<Object> deltaResult =
(List<Object>) ODataJPATombstoneContext.getDeltaResult(((EdmMapping) mapping).getInternalName());
result = handlePaging(deltaResult, uriParserResultView);