[ 
https://issues.apache.org/jira/browse/OLINGO-509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14300230#comment-14300230
 ] 

Aleh Autushka commented on OLINGO-509:
--------------------------------------

Hi Chandan,

It works fine. Here is the way how I use many to many relations in JPA (as 
example of the relation Company entity assignment to User entity is used):

In User entity:
    @ManyToMany
    private List<Company> companies = new ArrayList<Company>(); 

In Company entity:
        @ManyToMany(mappedBy="companies")
    private List<User> users = new ArrayList<User>();

Br, Aleh

> Problem with several relations of type ManyToMany in one entity
> ---------------------------------------------------------------
>
>                 Key: OLINGO-509
>                 URL: https://issues.apache.org/jira/browse/OLINGO-509
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core, odata2-jpa
>    Affects Versions: V2 2.0.1
>            Reporter: Aleh Autushka
>            Assignee: Chandan V.A
>            Priority: Critical
>             Fix For: V2 2.0.2
>
>
> Hello,
> Something strange is happening when I try to specify several relations of 
> type manyToMany in one entity (lets say relation A from entity 'a' to entity 
> 'b' and B from entity 'a' to entity 'c'). If I keep just relation 
> A or just relation B I can see this relation in the metadata with 
> Multiplicity * to *.
> When I keep both - both relations are gone from the metadata.
> Here are relations representation in JPA:
>     @ManyToMany(targetEntity=Phase.class)
>     @JoinTable(name="user_phase",joinColumns = @JoinColumn(name="userName", 
> referencedColumnName="userName"), inverseJoinColumns = @JoinColumn(name = 
> "phaseGuid", referencedColumnName="guid")) 
>     private java.util.Collection<Phase> phases;                       
>       
>     @ManyToMany(targetEntity=Role.class)
>     @JoinTable(name="user_role",joinColumns = @JoinColumn(name="userName", 
> referencedColumnName="userName"), inverseJoinColumns = @JoinColumn(name = 
> "roleName", referencedColumnName="roleName")) 
>     private java.util.Collection<Role> roles;
> With best regards, Aleh



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to