odata-client icon indicating copy to clipboard operation
odata-client copied to clipboard

Issue with Microsoft Dynamics EntityDefinitions/RelationshipDefinitions

Open blxbrgld opened this issue 3 years ago • 2 comments

Hello,

i'm trying to generate Java classes from a metadata xml following the logic of the odata-client-microsoft-dynamics client but the process fails with the following error:

manyToManyRelationships() in microsoft.dynamics.crm.entity.set.EntityDefinitions cannot override manyToManyRelationships() in microsoft.dynamics.crm.entity.collection.request.EntityMetadataCollectionRequest

The XML definitions for RelationshipDefinitions and EntityDefinitions in my metadata file are similar with those of https://github.com/davidmoten/odata-client/blob/master/odata-client-microsoft-dynamics/src/main/odata/microsoft-dynamics-crm4-v9.1-metadata.xml:

<EntitySet Name="RelationshipDefinitions" EntityType="Microsoft.Dynamics.CRM.RelationshipMetadataBase" />

<EntitySet Name="EntityDefinitions" EntityType="Microsoft.Dynamics.CRM.EntityMetadata">
  <NavigationPropertyBinding Path="Microsoft.Dynamics.CRM.BooleanAttributeMetadata/GlobalOptionSet" Target="GlobalOptionSetDefinitions" />
  <NavigationPropertyBinding Path="ManyToManyRelationships" Target="RelationshipDefinitions" />
  <NavigationPropertyBinding Path="ManyToOneRelationships" Target="RelationshipDefinitions" />
  <NavigationPropertyBinding Path="OneToManyRelationships" Target="RelationshipDefinitions" />
  <NavigationPropertyBinding Path="Microsoft.Dynamics.CRM.EnumAttributeMetadata/GlobalOptionSet" Target="GlobalOptionSetDefinitions" />
</EntitySet>

but the code generated (e.g. for manyToManyRelationships()) is:

public final class EntityDefinitions extends EntityMetadataCollectionRequest {

    public RelationshipDefinitions manyToManyRelationships() {
        return new RelationshipDefinitions(contextPath.addSegment("ManyToManyRelationships"));
    }	
}

public class EntityMetadataCollectionRequest extends CollectionPageEntityRequest<EntityMetadata, EntityMetadataRequest> {
    
	public ManyToManyRelationshipMetadataCollectionRequest manyToManyRelationships() {
        return new ManyToManyRelationshipMetadataCollectionRequest(contextPath.addSegment("ManyToManyRelationships"), Optional.empty());
    }
}

Am i doing something wrong? If i comment out the EntityDefinitions entity set, the process completes successfully. Can this be considered a solution to my problem or it will result a non functional client? What is the purpose of the EntityDefinitions entity set?

Thank you.

blxbrgld avatar Jun 23 '21 09:06 blxbrgld