[ 
https://issues.apache.org/jira/browse/OLINGO-414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14243796#comment-14243796
 ] 

Chandan V.A commented on OLINGO-414:
------------------------------------

Hi All
Query on OData entity is currently handled via JPQL statements. OData JPA 
processor builds JPQL "where" clause  from OData $filter condition. For $filter 
on navigation property we need to choose between two approaches
1) Build a JPQL statement that can handle $filter conditions on Navigation 
Property. With this approach we can restrict the number of records that are 
fetched from the DB. This approach requires constructing JQPL statements with 
Joins. 
2) Build a JPQL statement that retrieves all the parent entity (ignoring filter 
on navigation property). After all Parent entity has been fetched, start 
applying the $filter condition on navigation property on the parent entity's 
relationships. However in this approach we will be retrieving unwanted entities 
from DB.

This is the very reason why currently $filter is not supported in JPA Processor 
on navigation properties. Nevertheless I will try implementing the first 
approach (is little complex). If you all feel that first approach is not the 
correct or the best approach please do drop a comment, so we can discuss 
further.

Regards
Chandan

> Cannot Filter on Navigation Property
> ------------------------------------
>
>                 Key: OLINGO-414
>                 URL: https://issues.apache.org/jira/browse/OLINGO-414
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.0
>            Reporter: Simon Carroll
>            Assignee: Chandan V.A
>         Attachments: olingo-414-exception.diff, olingo-414-patch.diff
>
>
> We are receiving an error when we try to filter on a navigation property.  In 
> our solution we have a Notification entity and a User entity, we would like 
> to retrieve a specific Notification but only if it is linked to the 
> requesting user.  This would involve an ODATA request which filters on both 
> the UserId and the NotificationId.  An example of the URL we are invoking is:
> dspplatform.svc/Notifications?$filter=NotificationId%20eq%204%20and%20UserDetails/UserId%20eq%202
> This returns the following error:
> org.apache.olingo.odata2.core.edm.provider.EdmNavigationPropertyImplProv 
> cannot be cast to org.apache.olingo.odata2.api.edm.EdmProperty
> Can you please advise on how to perform filters on a Navigation property as 
> we need this as part of our core functionality?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to