Hello,
I have a ManyToMany relationship between two classes: ClassA and ClassB, but when the table for this relationship (table called objectA_objectB) there is no primary key on it.
In my ClassA I have the following:
@ManyToMany(fetch=FetchType.LAZY)
@OrderBy(value="name")
@JoinTable(name="objectA_objectB",
joinColumns=
@JoinColumn(name="idObjectA", referencedColumnName="id"),
inverseJoinColumns=
@JoinColumn(name="idObjectB", referencedColumnName="id")
)
private List<ClassB> objectsB;
and in my ClassB I have the reversed relation
@ManyToMany
List<ClassA> objectsA;
I just want to make a primary key of both id's but I need to change the name of the columns as I do. Why is the PK missing? How can I define it?
I use JPA 2.0 Hibernate implementation, if this helps.
Thanks.