I need to create table PORTATION_MODEL_SET. And I need to create two keys from table portation and one key from table phone_model
@ManyToMany(targetEntity = JDBCPhoneModel.class,
cascade = CascadeType.ALL,
fetch = FetchType.LAZY)
@JoinTable(name = "PORTATION_MODEL_SET",
joinColumns = {@JoinColumn(table = "PORTATION",
name = "fk_portation_id",
referencedColumnName = "id"),
@JoinColumn(table = "PORTATION",
name = "fk_content_id",
referencedColumnName = "fk_content_id",
nullable = true)},
inverseJoinColumns = @JoinColumn(table = "PHONE_MODEL",
name="fk_phone_model_id",
referencedColumnName = "id"))
private List phoneModel;
You were missing the referencedColumnName
from the inverseJoinColumns
definition. Please see if it's works for you.