I have a ManyToMany relation between two entity
@javax.persistence.Entity
@Table(name = "t_aircraft_model")
public class AircraftModel extends DbObject {
@ManyToMany(fetch=FetchType.LAZY)
@JoinTable(name = "t_aircraft_model_entity", joinColumns = { @JoinColumn(name = "aircraft_model_uid", nullable = false) }, inverseJoinColumns = { @JoinColumn(name = "entity_id_LDAP", nullable = false) })
private List<com.airbushelicopter.ahead.db.pojo.Entity> entities ;
But sqlServer doesn't allow me to publish the intermediate table : t_aircraft_model_entity
I thought about 2 solutions
- Both column of the table the t_aircraft_model_entity become the primary key (ok in my case a aircraft can't be linked multiple time to the same entity)
- I add a 3rd column (id) which will be the primary key
- Or ?
But I have no idea how I can do this with hibernate and annotation.
thanks !