Skip to content

$count function is not working with with MS SQL server #145

@kumar842

Description

@kumar842

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.
Annotation 2022-02-21 200426

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.

Annotation 2022-02-21 141828

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

Annotation 2022-02-21 143514

because the select count() query returns List.
Annotation 2022-02-21 142036

Can you please help or guide here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions