Skip to content

Filter Query Option - string functions not working with Hibernate #150

@vkhoroshko

Description

@vkhoroshko

Create any Entity with String field and make any filter query with using string function - e.g. contains/startswith/endswith

Example
GET http://localhost:8080/default/v1/Persons?$filter=contains(UserName,'test')

The response will be the following:
{ "error": { "code": null, "message": "Could not locate ordinal parameter [1], expecting one of [2]" } }

Digging at code I see that a visitor for the contains method is called twice (visitor.visitMethodCall) and creates 2 parameters instead of one and the criteria parsed query looks the following:
SELECT E0.username S0, E0.id S1 FROM person E0 WHERE (E0.username LIKE ?2)
while it really should be just 1 parameter and be 'LIKE ?1'

Looks like this is the cause of the issue. At the same time it works in the same way for EclipseLink but without errors.

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