[ 
https://issues.apache.org/jira/browse/OLINGO-1309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Archana Rai resolved OLINGO-1309.
---------------------------------
    Resolution: Fixed

> Olingo 2.0.10 breaking change for ENUM $filter support
> ------------------------------------------------------
>
>                 Key: OLINGO-1309
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1309
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.10
>            Reporter: Bruno Haller
>            Priority: Critical
>
>  
> We are using the olingo JPA processor and our entity has a field which is a 
> java Enum.
> When we issue the following OData request
> /Issues/$count?$filter=Status eq 'NEW'
> (where Status is the ENUM field), we are getting an exception
>  
> 2018-10-19 10:43:13.299 ERROR 3116 --- [o-auto-1-exec-4] 
> c.s.c.p.o.ProjectODataJPAErrorCallback : 
> org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException:
>  "OData - JPA Runtime: JPA query syntax is not correct"
>  java.lang.IllegalArgumentException: You have attempted to set a value of 
> type class java.lang.String for parameter 1 with expected type of class 
> com.sap.copin.project.model.enums.IssueStatus from query string SELECT COUNT 
> ( E1 ) FROM Issue E1 WHERE (E1.status LIKE ?1 ESCAPE '\').
>  
> With olingo 2.0.8 the generated SQL was:
> SELECT COUNT ( E1 ) FROM Issue E1 WHERE (E1.status = 'NEW')
>  
> With olingo 2.0.10 the generated SQL is:
> SELECT COUNT ( E1 ) FROM Issue E1 WHERE (E1.status LIKE ?1 ESCAPE '\')
>  
> Using the prepared statement is good, but this breaks ENUM support.
> Olingo should do a Enum.valueOf() call for Enum fields that are used in an 
> "equals" $filter expression to make it work again.
>  
> A similar feature is already implemented in JPAEntity.setProperty, but this 
> does not help for filtering.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to