Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在olingo中读取具有复杂属性的实体集合?_Java_Odata_Olingo - Fatal编程技术网

Java 如何在olingo中读取具有复杂属性的实体集合?

Java 如何在olingo中读取具有复杂属性的实体集合?,java,odata,olingo,Java,Odata,Olingo,我在ApacheOlingo页面上大致了解了这一点。我想读取具有复杂属性的实体集合 设置提供程序时,访问http://localhost:8080/api/odata/$metadata: <?xml version="1.0" encoding="UTF-8"?> <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"> <edmx:DataService

我在ApacheOlingo页面上大致了解了这一点。我想读取具有复杂属性的实体集合

设置提供程序时,访问
http://localhost:8080/api/odata/$metadata

<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
    <edmx:DataServices>
        <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="My.Namespace">
            <EntityType Name="MyEntity">
                <Key>
                    <PropertyRef Name="id"/>
                </Key>
                <Property Name="id" Type="Edm.String"></Property>
                <Property Name="name" Type="Edm.String"></Property>
                <Property Name="description" Type="Edm.String"></Property>
                <Property Name="complexProp" Type="My.Namespace.MyComplexType"></Property>
            </EntityType>
            <ComplexType Name="MyComplexType">
                <Property Name="id" Type="Edm.String"></Property>
                <Property Name="name" Type="Edm.String"></Property>
            </ComplexType>
            <EntityContainer Name="Container">
                <EntitySet Name="MyEntities" EntityType="My.Namespace.MyEntity"></EntitySet>
            </EntityContainer>
        </Schema>
    </edmx:DataServices>
</edmx:Edmx>
当在序列化程序上调用
entityCollection
时,进入代码会显示处理器的
readEntityCollection
方法中抛出的期望值


我一定错过了一个重要的要点,因为在我看来,
My.Namespace.MyComplexType
定义得很清楚。

虽然异常是在处理器中引发的,但错误与序列化无关

找不到复杂类型
MyComplexType
,因为EdmProvider中只覆盖了
getEntityType(最终FullQualifiedName entityTypeName)
,而没有覆盖
getComplexType(最终FullQualifiedName complexTypeName)
olingo
似乎通过调用这些方法来搜索类型


覆盖此方法后,所有数据都正确显示。

如果您认为
$metadata
输出有效,请发表评论。
Cannot find type with name: My.Namespace.MyComplexType