-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many to many support #22
Comments
That should be possible. In OData you do not directly see that it is a Many To Many relation. You only get to know that it is N:M if you look at both entities, as each navigation property is a collection: |
That's true and the navigation property is described well in the $metadata, but when I try to query the navigation items I get "No Join conditions where provided to create sub-query". That's because for ManyToMany in JPA I use Join Table @manytomany(fetch = LAZY) And when the processor is building the query it get's the Join Columns which are empty in this case. |
Unfortunately as of now the join columns have to be given as fields in the java pojo. If you do not want it to be part of the OData service you can suppress that by using an additional annotation: @EdmIgnore. Maybe the following example helps: @EdmIgnore //Ignore field for metadata generation
@Column(name = "\"BusinessPartnerID\"")
private String businessPartnerID;
@ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "\"BusinessPartnerID\"", insertable = false, updatable = false)
private BusinessPartner businessPartner; |
The join columns are in other table which isn't in the Entity that I'm targeting and the join table isn't represented as an entity itself. So does that mean that the ManyToMany mapping from JPA can't be represented in OData at this point, except with mapping the middle table and with ManyToOne from source and OneToMany from middle to the target entity? |
I like to distinguish between OData an the JPA Processor here:
|
@nikolay-angeloff |
Is this available in maven repository? can you please point me the dependency? |
Any solution for this bug? |
Is there a @manytomany support or how can I achieve such navigation in OData
The text was updated successfully, but these errors were encountered: