You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Chandan V.A (JIRA)" <ji...@apache.org> on 2015/06/10 10:23:00 UTC
[jira] [Commented] (OLINGO-683) Unable to query an entity using an
int id
[ https://issues.apache.org/jira/browse/OLINGO-683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14580211#comment-14580211 ]
Chandan V.A commented on OLINGO-683:
------------------------------------
Hello Arathi,
The issue is fixed with commit - http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/d0b3782c
Thanks
Kind Regards
Chandan
> Unable to query an entity using an int id
> -----------------------------------------
>
> Key: OLINGO-683
> URL: https://issues.apache.org/jira/browse/OLINGO-683
> Project: Olingo
> Issue Type: Bug
> Components: odata2-jpa
> Affects Versions: V2 2.0.3
> Reporter: arathi m
> Assignee: Chandan V.A
> Fix For: V2 2.0.5
>
>
> 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)) {
> uriLiteral = uriLiteral + JPQLStatement.DELIMITER.LONG; //$NON-NLS-1$
> }
> 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$
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)