SAP olingo-jpa-processor-v4 : $count function is not working with with MS SQL server

Viewed 81

API

http://localhost:8091/v1/Orders/$count

http://localhost:8091/v1/Orders?$count=true

Error:

{
    "error": {
        "code": null,
        "message": "class java.lang.Integer cannot be cast to class java.lang.Long"
       }
}

In MS SQL server, the return type of the count function is int.

enter image description here

JPAJoinQuery.java > CountResults() method will be called in case of /orders/$count or /orders?$count=true. This calls getSingleResult() (line no: 104). So, expected return type is Long.

enter image description here

TypeQueryImpl.java > getSingleResult() calls getResultList()(line no: 185), which returns List instead of List<Long)

enter image description here

because the select count() query returns List. enter image description here

Can somebody help here.

0 Answers
Related