Java Code Examples for org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException#throwException()

The following examples show how to use org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException#throwException() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JPAQueryBuilder.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
public Query build(GetEntityCountUriInfo uriInfo) throws ODataJPARuntimeException {
  Query query = null;
  try {
    ODataJPAQueryExtensionEntityListener listener = getODataJPAQueryEntityListener((UriInfo) uriInfo);
    if (listener != null) {
      query = listener.getQuery(uriInfo, em);
      JPQLContext jpqlContext = JPQLContext.getJPQLContext();
      query = getParameterizedQueryForListeners(jpqlContext, query);
    }
    if (query == null) {
      query = buildQuery((UriInfo) uriInfo, UriInfoType.GetEntityCount);
    }
  } catch (Exception e) {
    throw ODataJPARuntimeException.throwException(
        ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE, e);
  } finally {
    JPQLContext.removeJPQLContext();
    ODataExpressionParser.removePositionalParametersThreadLocal();
  }
  return query;
}
 
Example 2
Source File: ODataEntityParser.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex)
    throws ODataJPARuntimeException {
  UriInfo uriInfo = null;
  if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
    return uriInfo;
  }
  try {
    edm = getEdm();
    List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
    List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
    uriInfo = UriParser.parse(edm, subPathSegments, Collections.<String, String> emptyMap());
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return uriInfo;
}
 
Example 3
Source File: JPAQueryBuilder.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
public Query build(GetEntitySetCountUriInfo uriInfo) throws ODataJPARuntimeException {
  Query query = null;
  try {
    ODataJPAQueryExtensionEntityListener listener = getODataJPAQueryEntityListener((UriInfo) uriInfo);
    if (listener != null) {
      query = listener.getQuery(uriInfo, em);
      JPQLContext jpqlContext = JPQLContext.getJPQLContext();
      query = getParameterizedQueryForListeners(jpqlContext, query);
    }
    if (query == null) {
      query = buildQuery((UriInfo) uriInfo, UriInfoType.GetEntitySetCount);
    }
  } catch (Exception e) {
    throw ODataJPARuntimeException.throwException(
        ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE, e);
  } finally {
    JPQLContext.removeJPQLContext();
    ODataExpressionParser.removePositionalParametersThreadLocal();
  }
  return query;
}
 
Example 4
Source File: ODataEntityParser.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options)
    throws ODataJPARuntimeException {
  List<PathSegment> pathSegments = new ArrayList<PathSegment>();
  for (String link : linkSegments) {
    List<PathSegment> pathSegment = getPathSegment(link);
    pathSegments.addAll(pathSegment);
  }
  UriInfo uriInfo = null;
  try {
    edm = getEdm();
    uriInfo = UriParser.parse(edm, pathSegments, options);
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return uriInfo;
}
 
Example 5
Source File: ODataJPAResponseBuilderDefault.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
    final GetEntityUriInfo resultsView) throws ODataJPARuntimeException {
  ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
  ExpandSelectTreeNode expandSelectTree = null;
  try {
    entityFeedPropertiesBuilder =
        EntityProviderWriteProperties.serviceRoot(odataJPAContext.getODataContext().getPathInfo().getServiceRoot());
    expandSelectTree = UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
    entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);
    entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(odataJPAContext.getODataContext()
        .getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
  }

  return entityFeedPropertiesBuilder.build();
}
 
Example 6
Source File: JPAProcessorImpl.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
@Override
public Object process(DeleteUriInfo uriParserResultView, final String contentType)
    throws ODataJPAModelException, ODataJPARuntimeException {
  if (uriParserResultView instanceof DeleteUriInfo) {
    if (((UriInfo) uriParserResultView).isLinks()) {
      return deleteLink(uriParserResultView);
    }
  }
  Object selectedObject = readEntity(new JPAQueryBuilder(oDataJPAContext).build(uriParserResultView));
  if (selectedObject != null) {
    try{
      boolean isLocalTransaction = setTransaction();
      em.remove(selectedObject);
      em.flush(); 
      if (isLocalTransaction) {
        oDataJPAContext.getODataJPATransaction().commit();
      }
    } catch(PersistenceException e){
      em.getTransaction().rollback();
      throw ODataJPARuntimeException.throwException(
          ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST, e);
    }
  }
  return selectedObject;
}
 
Example 7
Source File: ODataExpressionParser.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
private static String getPropertyName(final CommonExpression whereExpression) throws EdmException,
    ODataJPARuntimeException {
  EdmTyped edmProperty = ((PropertyExpression) whereExpression).getEdmProperty();
  EdmMapping mapping;
  if (edmProperty instanceof EdmNavigationProperty) {
    EdmNavigationProperty edmNavigationProperty = (EdmNavigationProperty) edmProperty;
    mapping = edmNavigationProperty.getMapping();
  } else if(edmProperty instanceof EdmProperty) {
    EdmProperty property = (EdmProperty) edmProperty;
    mapping = property.getMapping();
  } else {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, null);
  }

  return mapping != null ? mapping.getInternalName() : edmProperty.getName();
}
 
Example 8
Source File: JPAEntity.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
private void normalizeInlineEntries(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
  List<ODataEntry> entries = null;
  try {
    for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
      Object inline = oDataEntryProperties.get(navigationPropertyName);
      if (inline instanceof ODataFeed) {
        entries = ((ODataFeed) inline).getEntries();
      } else if (inline instanceof ODataEntry) {
        entries = new ArrayList<ODataEntry>();
        entries.add((ODataEntry) inline);
      }
      if (entries != null) {
        oDataEntryProperties.put(navigationPropertyName, entries);
        entries = null;
      }
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException
        .throwException(ODataJPARuntimeException.GENERAL
            .addContent(e.getMessage()), e);
  }
}
 
Example 9
Source File: JPQLJoinSelectSingleContext.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
  try {
    setType(JPQLContextType.JOIN_SINGLE);
    setJPAJoinClause(generateJoinClauses());

    if (!jpaJoinClauses.isEmpty()) {
      JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
      setJPAEntityName(joinClause.getEntityName());
      setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
    }

    setKeyPredicates(entityView.getKeyPredicates());

    setSelectExpression(generateSelectExpression());
    
    setJPQLContext(JPQLJoinSelectSingleContext.this);
    
  } catch (EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, e);
  }

  return JPQLJoinSelectSingleContext.this;
}
 
Example 10
Source File: JPALink.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
public void create(final EdmEntitySet entitySet, final ODataEntry oDataEntry,
    final List<String> navigationPropertyNames)
    throws ODataJPARuntimeException,
    ODataJPAModelException {

  List<Object> targetJPAEntities = new ArrayList<Object>();
  try {
    for (String navPropertyName : navigationPropertyNames) {
      List<String> links = oDataEntry.getMetadata().getAssociationUris(navPropertyName);
      if (links == null || links.isEmpty() == true) {
        links = extractLinkURI(oDataEntry, navPropertyName);
      }
      if (links != null && links.isEmpty() == false) {

        EdmNavigationProperty navProperty = (EdmNavigationProperty) entitySet.getEntityType()
            .getProperty(
                navPropertyName);

        for (String link : links) {
          UriInfo bindingUriInfo = parser.parseBindingLink(link, new HashMap<String, String>());
          targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) bindingUriInfo);
          if (targetJPAEntity != null) {
            targetJPAEntities.add(targetJPAEntity);
          }
        }
        if (targetJPAEntity == null){
          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
              .addContent(navPropertyName), null);
        }
        if (!targetJPAEntities.isEmpty()) {
          linkJPAEntities(targetJPAEntities, sourceJPAEntity, navProperty);
        }
        targetJPAEntities.clear();
      }
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }

}
 
Example 11
Source File: ODataJPAResponseBuilderDefault.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
private static List<EdmProperty> buildSelectItemList(final List<SelectItem> selectItems, final EdmEntityType entity)
    throws ODataJPARuntimeException {
  boolean flag = false;
  List<EdmProperty> selectPropertyList = new ArrayList<EdmProperty>();
  try {
    for (SelectItem selectItem : selectItems) {
      if (selectItem.getNavigationPropertySegments().size() <= 0) {
        if (selectItem.isStar()) {
          selectPropertyList.addAll(getEdmProperties(entity));
          return selectPropertyList;
        } else {
          selectPropertyList.add(selectItem.getProperty());
        }
      }
    }
    for (EdmProperty keyProperty : entity.getKeyProperties()) {
      flag = true;
      for (SelectItem selectedItem : selectItems) {
        if (!selectedItem.isStar() && keyProperty.equals(selectedItem.getProperty())) {
          flag = false;
          break;
        }
      }
      if (flag) {
        selectPropertyList.add(keyProperty);
      }
    }

  } catch (EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
  return selectPropertyList;
}
 
Example 12
Source File: ODataJPAResponseBuilderDefault.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Override
public ODataResponse build(final GetEntityLinkUriInfo resultsView, final Object jpaEntity,
    final String contentType) throws ODataNotFoundException,
    ODataJPARuntimeException {

  if (jpaEntity == null) {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
  }
  EdmEntityType edmEntityType = null;
  ODataResponse odataResponse = null;

  try {

    EdmEntitySet entitySet = resultsView.getTargetEntitySet();
    edmEntityType = entitySet.getEntityType();
    Map<String, Object> edmPropertyValueMap = null;

    JPAEntityParser jpaResultParser = new JPAEntityParser();
    edmPropertyValueMap = jpaResultParser.parse2EdmPropertyValueMap(jpaEntity, edmEntityType.getKeyProperties());

    EntityProviderWriteProperties entryProperties =
        EntityProviderWriteProperties.serviceRoot(oDataJPAContext.getODataContext().getPathInfo().getServiceRoot())
            .build();

    ODataResponse response = EntityProvider.writeLink(contentType, entitySet, edmPropertyValueMap, entryProperties);

    odataResponse = ODataResponse.fromResponse(response).build();

  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);

  }

  return odataResponse;
}
 
Example 13
Source File: ODataJPAResponseBuilderDefault.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
private static List<EdmProperty> getEdmProperties(final EdmStructuralType structuralType)
    throws ODataJPARuntimeException {
  List<EdmProperty> edmProperties = new ArrayList<EdmProperty>();
  try {
    for (String propertyName : structuralType.getPropertyNames()) {
      edmProperties.add((EdmProperty) structuralType.getProperty(propertyName));
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
  }
  return edmProperties;
}
 
Example 14
Source File: JPQLJoinSelectContext.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Override
public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
  try {

    if (JPQLJoinSelectContext.this.isCountOnly) {
      setType(JPQLContextType.JOIN_COUNT);
    } else {
      setType(JPQLContextType.JOIN);
    }

    if (withPaging) {
      isPagingRequested(withPaging);
    }

    setJPAOuterJoinClause(generateJoinClauses());

    if (!jpaJoinClauses.isEmpty()) {
      JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
      setJPAEntityName(joinClause.getEntityName());
      setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
    }

    setOrderByCollection(generateOrderByFileds());

    setSelectExpression(generateSelectExpression());

    setWhereExpression(generateWhereExpression());
    
    setJPQLContext(JPQLJoinSelectContext.this);

  } catch (ODataException e) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
  }
  
  

  return JPQLJoinSelectContext.this;
}
 
Example 15
Source File: JPAServiceFactory.java    From lemonaid with MIT License 5 votes vote down vote up
private void validatePreConditions() throws ODataJPARuntimeException {

		if (oDataJPAContext.getEntityManagerFactory() == null) {
			throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ENTITY_MANAGER_NOT_INITIALIZED,
					null);
		}

	}
 
Example 16
Source File: JPAMethodContext.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
private static JPAMethodContextBuilder create(final JPQLContextType contextType, final Object resultsView)
    throws ODataJPARuntimeException {
  JPAMethodContextBuilder contextBuilder =
      ODataJPAFactory.createFactory().getJPQLBuilderFactory().getJPAMethodContextBuilder(contextType);

  if (contextBuilder == null) {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQLCTXBLDR_CREATE, null);
  }
  contextBuilder.setResultsView(resultsView);
  return contextBuilder;
}
 
Example 17
Source File: JPQLJoinStatementBuilder.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
private String createJPQLQuery() throws ODataJPARuntimeException {

    StringBuilder jpqlQuery = new StringBuilder();
    StringBuilder joinWhereCondition = null;

    jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(JPQLStatement.DELIMITER.SPACE);
    if (context.getType().equals(JPQLContextType.JOIN_COUNT)) {// $COUNT
      jpqlQuery.append(JPQLStatement.KEYWORD.COUNT).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(JPQLStatement.DELIMITER.PARENTHESIS_LEFT).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(JPQLStatement.DELIMITER.PARENTHESIS_RIGHT).append(JPQLStatement.DELIMITER.SPACE);
    } else { // Normal
      jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
    }

    jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);

    if (context.getJPAJoinClauses() != null && !context.getJPAJoinClauses().isEmpty()) {
      List<JPAJoinClause> joinClauseList = context.getJPAJoinClauses();
      JPAJoinClause joinClause = joinClauseList.get(0);
      String joinCondition = joinClause.getJoinCondition();
      joinWhereCondition = new StringBuilder();
      if (joinCondition != null) {
        joinWhereCondition.append(joinCondition);
      }
      String relationShipAlias = null;
      joinClause = joinClauseList.get(1);
      jpqlQuery.append(joinClause.getEntityName()).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(joinClause.getEntityAlias());

      int i = 1;
      int limit = joinClauseList.size();
      relationShipAlias = joinClause.getEntityAlias();
      while (i < limit) {
        jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(JPQLStatement.DELIMITER.SPACE);

        joinClause = joinClauseList.get(i);
        jpqlQuery.append(relationShipAlias).append(JPQLStatement.DELIMITER.PERIOD);
        jpqlQuery.append(joinClause.getEntityRelationShip()).append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(joinClause.getEntityRelationShipAlias());

        relationShipAlias = joinClause.getEntityRelationShipAlias();
        i++;

        joinCondition = joinClause.getJoinCondition();
        if (joinCondition != null) {
          joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND
              + JPQLStatement.DELIMITER.SPACE);

          joinWhereCondition.append(joinCondition);
        }
      }
    } else {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED, null);
    }
    String whereExpression = context.getWhereExpression();
    if (whereExpression != null || joinWhereCondition.length() > 0) {
      jpqlQuery.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.KEYWORD.WHERE).append(
          JPQLStatement.DELIMITER.SPACE);
      if (whereExpression != null) {
        jpqlQuery.append(whereExpression);
        if (joinWhereCondition != null) {
          jpqlQuery.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND + JPQLStatement.DELIMITER.SPACE);
        }
      }
      if (joinWhereCondition != null) {
        jpqlQuery.append(joinWhereCondition.toString());
      }

    }

    if (context.getOrderByCollection() != null && context.getOrderByCollection().length() > 0) {

      StringBuilder orderByBuilder = new StringBuilder();
      orderByBuilder.append(context.getOrderByCollection());
      jpqlQuery.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.KEYWORD.ORDERBY).append(
          JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(orderByBuilder);
    }

    return jpqlQuery.toString();
  }
 
Example 18
Source File: ODataJPAQueryExtensionEntityListener.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
protected ODataJPARuntimeException createApplicationError(String message, Locale locale) {
  return ODataJPARuntimeException.throwException(
      ODataJPARuntimeException.GENERAL, new ODataApplicationException(message, locale));
}
 
Example 19
Source File: JPQLJoinSelectSingleStatementBuilder.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
private String createJPQLQuery() throws ODataJPARuntimeException {

    StringBuilder jpqlQuery = new StringBuilder();
    StringBuilder joinWhereCondition = null;

    jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(JPQLStatement.DELIMITER.SPACE);
    jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
    jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);

    if (context.getJPAJoinClauses() != null && !context.getJPAJoinClauses().isEmpty()) {
      List<JPAJoinClause> joinClauseList = context.getJPAJoinClauses();
      JPAJoinClause joinClause = joinClauseList.get(0);
      String joinCondition = joinClause.getJoinCondition();
      joinWhereCondition = new StringBuilder();
      if (joinCondition != null) {
        joinWhereCondition.append(joinCondition);
      }
      String relationShipAlias = null;
      joinClause = joinClauseList.get(1);
      jpqlQuery.append(joinClause.getEntityName()).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(joinClause.getEntityAlias());

      int i = 1;
      int limit = joinClauseList.size();
      relationShipAlias = joinClause.getEntityAlias();
      while (i < limit) {
        jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(JPQLStatement.DELIMITER.SPACE);

        joinClause = joinClauseList.get(i);
        jpqlQuery.append(relationShipAlias).append(JPQLStatement.DELIMITER.PERIOD);
        jpqlQuery.append(joinClause.getEntityRelationShip()).append(JPQLStatement.DELIMITER.SPACE);
        jpqlQuery.append(joinClause.getEntityRelationShipAlias());

        relationShipAlias = joinClause.getEntityRelationShipAlias();
        i++;

        joinCondition = joinClause.getJoinCondition();
        if (joinCondition != null) {
          joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND
              + JPQLStatement.DELIMITER.SPACE);

          joinWhereCondition.append(joinCondition);
        }

      }
    } else {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED, null);
    }

    if (joinWhereCondition.length() > 0) {
      jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(JPQLStatement.KEYWORD.WHERE).append(JPQLStatement.DELIMITER.SPACE);
      jpqlQuery.append(joinWhereCondition.toString());
    }

    return jpqlQuery.toString();

  }
 
Example 20
Source File: ODataJPAServiceFactory.java    From olingo-odata2 with Apache License 2.0 3 votes vote down vote up
private void validatePreConditions() throws ODataJPARuntimeException {

    if (oDataJPAContext.getEntityManager() == null) {
      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ENTITY_MANAGER_NOT_INITIALIZED, null);
    }

  }