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

Mitko Kolev updated OLINGO-857:
-------------------------------
    Description: 
Using different namespaces for olingo annotated POJOs and the 
AnnotationEdmProvider may produce unparsable queries. Here is how to reproduce:
* create model that uses 2 namespaces with navigation between entities, for 
example the entities {{A}} and {{B}} have namespace {{AB}}, the entities {{C}}, 
{{D}} have namespace {{CD}}.
{code}
@EdmEntityType(name = "A", namespace = "AB")
    @EdmEntitySet(name = "AA")
    class A {
        @EdmKey
        @EdmProperty
        String id;
        @EdmNavigationProperty(toMultiplicity = Multiplicity.ZERO_OR_ONE, 
toType = B.class)
        B b;
    }
    @EdmEntityType(name = "B", namespace = "AB")
    @EdmEntitySet
    class B {
        @EdmNavigationProperty(toMultiplicity = Multiplicity.MANY, toType = 
A.class)
        List<A> a;
    }
    @EdmEntityType(name = "C", namespace = "CD")
    @EdmEntitySet(name = "CC")
    class C {
        @EdmKey
        @EdmProperty
        String id;
        @EdmNavigationProperty(toMultiplicity = Multiplicity.ZERO_OR_ONE, 
toType = D.class)
        D d;
    }
    @EdmEntityType(name = "D", namespace = "CD")
    @EdmEntitySet
    class D {
        @EdmNavigationProperty(toMultiplicity = Multiplicity.MANY, toType = 
C.class)
        List<C> c;
    }
{code}
* Now build the model with 
{code}
new AnnotationEdmProvider(Arrays.<Class<?>> asList(A.class, B.class, C.class, 
D.class));      
{code}
* The query http://localhost/CC('1')/D results in 
 Attempt to parse these queries results in 
{code}
org.apache.olingo.odata2.api.edm.EdmException: An exception occurred.
        at 
org.apache.olingo.odata2.core.edm.provider.EdmEntityContainerImplProv.getAssociationSet(EdmEntityContainerImplProv.java:169)
        at 
...
{code}

I guess the reason is that the default namespace container is generated in the 
wrong schema (the schema for the last entities in the list)

This issue is blocking our development. 

  was:
Using different namespaces for olingo annotated POJOs may produce unparsable 
queries. Here is how to reproduce:
* create model that uses 2 namespaces with navigation between entities, for 
example the entities {{A}} and {{B}} have namespace {{AB}}, the entities {{C}}, 
{{D}} have namespace {{CD}}.
{code}
@EdmEntityType(name = "A", namespace = "AB")
    @EdmEntitySet(name = "AA")
    class A {
        @EdmKey
        @EdmProperty
        String id;
        @EdmNavigationProperty(toMultiplicity = Multiplicity.ZERO_OR_ONE, 
toType = B.class)
        B b;
    }
    @EdmEntityType(name = "B", namespace = "AB")
    @EdmEntitySet
    class B {
        @EdmNavigationProperty(toMultiplicity = Multiplicity.MANY, toType = 
A.class)
        List<A> a;
    }
    @EdmEntityType(name = "C", namespace = "CD")
    @EdmEntitySet(name = "CC")
    class C {
        @EdmKey
        @EdmProperty
        String id;
        @EdmNavigationProperty(toMultiplicity = Multiplicity.ZERO_OR_ONE, 
toType = D.class)
        D d;
    }
    @EdmEntityType(name = "D", namespace = "CD")
    @EdmEntitySet
    class D {
        @EdmNavigationProperty(toMultiplicity = Multiplicity.MANY, toType = 
C.class)
        List<C> c;
    }
{code}
* Now build the model with 
{code}
new AnnotationEdmProvider(Arrays.<Class<?>> asList(A.class, B.class, C.class, 
D.class));      
{code}
* The query http://localhost/CC('1')/D results in 
 Attempt to parse these queries results in 
{code}
org.apache.olingo.odata2.api.edm.EdmException: An exception occurred.
        at 
org.apache.olingo.odata2.core.edm.provider.EdmEntityContainerImplProv.getAssociationSet(EdmEntityContainerImplProv.java:169)
        at 
...
{code}

I guess the reason is that the default namespace container is generated in the 
wrong schema (the schema for the last entities in the list)

This issue is blocking our development. 


> AnnotationEdmProvider generates unparsable EDM
> ----------------------------------------------
>
>                 Key: OLINGO-857
>                 URL: https://issues.apache.org/jira/browse/OLINGO-857
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-annotation
>    Affects Versions: V2 2.0.5
>         Environment: Java version 2
>            Reporter: Mitko Kolev
>         Attachments: -Edm-model-with-namespaces.patch, ABCD.edmx, CDAB.edmx, 
> long-description.txt
>
>
> Using different namespaces for olingo annotated POJOs and the 
> AnnotationEdmProvider may produce unparsable queries. Here is how to 
> reproduce:
> * create model that uses 2 namespaces with navigation between entities, for 
> example the entities {{A}} and {{B}} have namespace {{AB}}, the entities 
> {{C}}, {{D}} have namespace {{CD}}.
> {code}
> @EdmEntityType(name = "A", namespace = "AB")
>     @EdmEntitySet(name = "AA")
>     class A {
>         @EdmKey
>         @EdmProperty
>         String id;
>         @EdmNavigationProperty(toMultiplicity = Multiplicity.ZERO_OR_ONE, 
> toType = B.class)
>         B b;
>     }
>     @EdmEntityType(name = "B", namespace = "AB")
>     @EdmEntitySet
>     class B {
>         @EdmNavigationProperty(toMultiplicity = Multiplicity.MANY, toType = 
> A.class)
>         List<A> a;
>     }
>     @EdmEntityType(name = "C", namespace = "CD")
>     @EdmEntitySet(name = "CC")
>     class C {
>         @EdmKey
>         @EdmProperty
>         String id;
>         @EdmNavigationProperty(toMultiplicity = Multiplicity.ZERO_OR_ONE, 
> toType = D.class)
>         D d;
>     }
>     @EdmEntityType(name = "D", namespace = "CD")
>     @EdmEntitySet
>     class D {
>         @EdmNavigationProperty(toMultiplicity = Multiplicity.MANY, toType = 
> C.class)
>         List<C> c;
>     }
> {code}
> * Now build the model with 
> {code}
> new AnnotationEdmProvider(Arrays.<Class<?>> asList(A.class, B.class, C.class, 
> D.class));      
> {code}
> * The query http://localhost/CC('1')/D results in 
>  Attempt to parse these queries results in 
> {code}
> org.apache.olingo.odata2.api.edm.EdmException: An exception occurred.
>       at 
> org.apache.olingo.odata2.core.edm.provider.EdmEntityContainerImplProv.getAssociationSet(EdmEntityContainerImplProv.java:169)
>       at 
> ...
> {code}
> I guess the reason is that the default namespace container is generated in 
> the wrong schema (the schema for the last entities in the list)
> This issue is blocking our development. 



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

Reply via email to