javaodataolingo

Update parent and child entities in same PUT and navigation link with olingo2


I have two questions: 1- Is it possible to update a parent entity and its child by single PUT using Olingo2?

2- Is it possible to update a navigation link (many-to-one relationship) of an entity? (ex updating Product entity Product.categoryId = 1 --> Product.categoryId = 2)

I read the documentation and that it is possible with odata4 and olingo4 but I am not sure that it is possible natively with olingo2.

Thanks


Solution

  • 1° it is not mentioned into odata specifications, the only way is to perform a $batch

    2° it is possible like this:

    PUT http://host:port/odata/Entities(parentID)

    { "RelationshipDetails": { "__metadata": { "uri": "http://host:port/odata/Relationships(newRelationshipID)" } } }