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

Alex Key commented on OLINGO-414:
---------------------------------

HI Michael,

we tested this patch on our end and it looks like it is working as expected.
But we found one nasty issue, which probably needs to be handled on olingo side 
as well.
Problem is with ManyToMany relations.
For example, let's imagine that we have object A and object B with ManyToMany 
relationship and object B has int property x.
When olingo receives the following request
{noformat}
.../As?$filter=((BDetails/x eq 1 or BDetails/x eq 2))
{noformat}
then it generates and executes the following query:
{noformat}
SELECT a FROM A a JOIN B b WHERE b.x = 1 or b.x = 2
{noformat}
If in database there is object A, which has 2 objects B (first with x = 1 and 
second with x = 2), then this query and olingo odata2 service returns 2 
duplicate records.
As per JPA this can be solved by using SELECT DISTINCT. I think that we can 
always use "DISTINCT" in our queries, it shouldn't break anything.
What are Your thoughts?

Best regards,
Alex

> 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: Michael Bolz
>         Attachments: olingo-414-exception.diff, olingo-414-patch.diff, 
> olingo-odata2-parent.patch
>
>
> 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