Class JPAExpandJoinQuery

All Implemented Interfaces:
JPAQuery

public final class JPAExpandJoinQuery extends JPAAbstractJoinQuery
A query to retrieve the expand entities.

According to OData Version 4.0 Part 2 - 5.1.2 System Query Option $expand the following query options are allowed:

  • expandCountOption = filter/ search

  • expandRefOption = expandCountOption/ orderby / skip / top / inlinecount
  • expandOption = expandRefOption/ select/ expand / levels

As of now only the bold once are supported

Author:
Oliver Grande
  • Constructor Details

  • Method Details

    • execute

      public JPAExpandQueryResult execute() throws org.apache.olingo.server.api.ODataApplicationException
      Process a expand query, which may contains a $skip and/or a $top option.

      This is a tricky problem, as it can not be done easily with SQL. It could be that a database offers special solutions. There is an worth reading blog regards this topic: How to select the first/least/max row per group in SQL. Often databases offer the option to use ROW_NUMBER together with OVER ... ORDER BY see e.g. SQL ROW_NUMBER. Unfortunately this is not supported by JPA.

      Returns:
      query result
      Throws:
      org.apache.olingo.server.api.ODataApplicationException
    • createSelectClause

      protected List<javax.persistence.criteria.Selection<?>> createSelectClause(Map<String,​javax.persistence.criteria.From<?,​?>> joinTables, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> jpaPathList, javax.persistence.criteria.From<?,​?> target, List<String> groups) throws org.apache.olingo.server.api.ODataApplicationException
      Description copied from class: JPAAbstractJoinQuery
      The value of the $select query option is a comma-separated list of properties, qualified action names, qualified function names, the star operator (*), or the star operator prefixed with the namespace or alias of the schema in order to specify all operations defined in the schema. See: OData Version 4.0 Part 1 - 11.2.4.1 System Query Option $select

      See also: OData Version 4.0 Part 2 - 5.1.3 System Query Option $select

      Overrides:
      createSelectClause in class JPAAbstractJoinQuery
      Returns:
      Throws:
      org.apache.olingo.server.api.ODataApplicationException
    • buildSelectionPathList

      protected Set<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> buildSelectionPathList(org.apache.olingo.server.api.uri.UriInfoResource uriResource) throws org.apache.olingo.server.api.ODataApplicationException
      Description copied from class: JPAAbstractJoinQuery
      Creates the path to all properties that need to be selected from the database. A Property can be included for the following reasons:
      • It is a key in order to be able to build the links
      • It is part of the $select system query option
      • It is the result of a navigation, which my be restricted by a $select
      • If is required to link $expand with result with the parent result
      • A stream is requested and the property contains the mime type
      Not included are collection properties.
      Overrides:
      buildSelectionPathList in class JPAAbstractJoinQuery
      Returns:
      Throws:
      org.apache.olingo.server.api.ODataApplicationException