Open vkhoroshko opened 2 years ago
I was able to reproduce the error. It looks like it is within the component odata-jpa-processor-cb. You can deactivate this in the pom, then the Hibernate Criteria Builder is used. In my test this worked.
@wog48 Thank you. So if Hibernate is used - odata-jpa-processor-cb module is not needed right?
There is no real need to use odata-jpa-processor-cb module, neither when using EclipseLink nor when using Hibernate. It provide an extension of the JPA Criteria Builder API. As mentioned in the README it enables a diffrent way to generate queries in case $expand shall be paged.
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.