SAP / olingo-jpa-processor-v4

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.
Apache License 2.0
122 stars 78 forks source link

Count issue in Oracle with composite key #205

Open sungongpeng opened 1 year ago

sungongpeng commented 1 year ago

OData count from a composite key, http://[localhost:9010/Trippin/v1/Trips?$count=true translate to query again db SELECT COUNT(DISTINCT(E0."ID", E0."Entity")) S0 FROM "Trippin"."Trip" E0 works fine with hsqldb.

but for Oracle database, it throw ORA-00907: missing right parenthesis error.

how to customize the query to one that can run in Oracle database, like SELECT E0."ID" || E0."ENTITY" || E0."DATA" FROM "PENFAX"."TRIP" E0

OR

SELECT COUNT (*) FROM ( SELECT DISTINCT E0."ID" S0, E0."ENTITY" S1, E0."DATA" S2 FROM "PENFAX"."TRIP" E0)

wog48 commented 1 year ago

As you have noticed, the JPA Processor not all databases support COUNT(DISTINCT(E0."ID", E0."Entity")). It will be investigated what the best way to replace this construct.