I have a ManyToMany mapping like this (I have changed the name of columns and properties):
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name="ACTION_COMPANY_CONTACTS",
joinColumns={
@JoinColumn(name="ID_ACTION", referencedColumnName="ID_ACTION"),
@JoinColumn(name="ID_COMPANY", referencedColumnName="ID_COMPANY"),
@JoinColumn(name="TYPE", referencedColumnName="TYPE")
},
inverseJoinColumns={
@JoinColumn(name="ID_CONTACT", referencedColumnName="ID_CONTACT"),
@JoinColumn(name="TYPE", referencedColumnName="TYPE")
})
private List<Contact> contacts;
But I get the exception:
org.hibernate.MappingException: Repeated column in mapping for collection: mypackage.ActionCompany.contacts column: TYPE
It is possible to declare a ManyToMany mapping with the same column used in in both joinColumns oand inverseJoinColumns? If not, is there some alternative?
I have already tried to use insertable and updatable = false in one of the join declarations for column TYPE, but I still get the same exception.