Using:
- eclipselink 4.0.3
- odata-jpa-processor 2.3.3
I created two entities "Items" and "ItemCategory" connected with a ManyToMany relation.
@Entity
public class Item {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
private String id;
private String name;
@ManyToMany
@JoinTable(name = "item_itemcategory", joinColumns = {
@JoinColumn(name = "item_id", table = "item", referencedColumnName = "id") }, inverseJoinColumns = {
@JoinColumn(name = "itemcategory_id", table = "itemcategory", referencedColumnName = "id") })
private List<ItemCategory> itemCategories = new LinkedList<>();
and
@Entity
public class ItemCategory {
@Id
private String id;
private String name;
metadata:
<EntityType Name="Item">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="Name" Type="Edm.String"/>
<Property Name="Id" Type="Edm.String"/>
<NavigationProperty Name="ItemCategories" Type="Collection(simpledsa.ItemCategory)"/>
</EntityType>
<EntityType Name="ItemCategory">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="Name" Type="Edm.String"/>
<Property Name="Id" Type="Edm.String"/>
</EntityType>
The entities use a join table for their connection.
Reading the content, e.g. using an $expand, works fine but creating an item while binding categories fails.
Request: POST
Body:
{
"Name": "test",
"ItemCategories@odata.bind": [
"ItemCategories('EQCAT_1')",
"ItemCategories('EQCAT_2')"
]
}
Error: 500 - ON condition right attribute is null / not found.
I think, the problem lies in the function buildSimpleKeys of the class com.sap.olingo.jpa.processor.core.processor.JPARequestLinkImpl because creating the JoinColumnsList with the method getJoinColumnsList referres to the tables of both entities instead to the join table.
Question is: Have I done something wrong in my setup?
Using:
I created two entities "Items" and "ItemCategory" connected with a ManyToMany relation.
and
metadata:
The entities use a join table for their connection.
Reading the content, e.g. using an $expand, works fine but creating an item while binding categories fails.
Request: POST
Body:
Error: 500 - ON condition right attribute is null / not found.
I think, the problem lies in the function
buildSimpleKeysof the classcom.sap.olingo.jpa.processor.core.processor.JPARequestLinkImplbecause creating theJoinColumnsListwith the methodgetJoinColumnsListreferres to the tables of both entities instead to the join table.Question is: Have I done something wrong in my setup?