Hi!
We use a bidirectional ManyToMany connection with a Jointable like this:
Code:
@Entity(name="group")
public class Group {
...
@ManyToMany(targetEntity = User.class)
@JoinTable(joinColumns = @JoinColumn(name = "group_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
private Set<User> users = new HashSet<User>();
}
@Entity
public class User {
...
@ManyToMany(mappedBy = "users", targetEntity = Group.class)
private Set<Group> groups = new HashSet<Group>();
}
this works great!
After the Obfuscation, the field names are renamed as expected. So maybe it looks like this:
Code:
@Entity(name="group")
public class A {
...
@ManyToMany(targetEntity = B.class)
@JoinTable(joinColumns = @JoinColumn(name = "group_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
private Set<B> a = new HashSet<B>();
}
@Entity
public class B {
...
@ManyToMany(mappedBy = "users", targetEntity = A.class)
private Set<A> a = new HashSet<A>();
}
Not the Problem is, that the mappedBy attribute for the field a in the class B still refers to the field "users" which has been obfuscated and renamed to simply "a". So is there a way (except telling the obfuscator not to change the field name) to keep the correct reference in the "mappedBy" attribute? The @Column(name="users") Annotation for A.a will not work, because "users" is not a column in the table "group"
Thanks