Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
V2 2.0.3
-
None
Description
I have a MySQL table with an int primary key. I exposed my database table using an Odata service using Olingo-odata2 JPA processor. When I query my entity set using this URL:
http://host/emplist-web/emplist.svc/Customers(1)
I get "Requested Resource not found exception". But the record exists with id=1.
I debugged code and found that the JPQL generated is Select E1.Customer from Customers E1 where E1.id=1L. But since my id is an int, the JPQL should be Select E1.Customer from Customers E1 where E1.id=1.
I further debugged and the error is in evaluateComparingExpression of org.apache.olingo.odata2.jpa.processor.core.ODataExpressionParser
evaluateComparingExpression method.
This code:
else if (EdmSimpleTypeKind.Int64.getEdmSimpleTypeInstance().isCompatible(edmSimpleType))
adds the erroneous JPQL I mentioned earlier. The fix would be to replace above with this
else if(EdmSimpleTypeKind.Int32.getEdmSimpleTypeInstance().equals(edmSimpleType))
{ uriLiteral = uriLiteral; }
else if (EdmSimpleTypeKind.Int64.getEdmSimpleTypeInstance().isCompatible(edmSimpleType)) { uriLiteral = uriLiteral + JPQLStatement.DELIMITER.LONG; //$NON-NLS-1$ }