I use spring data jpa and i try to do a many to many unidirectional relation.
@Entity
public class Appartment {
...
@ManyToMany
private List<AppartmentFeatureOption> featureOption;
}
@Entity
public class AppartmentFeatureOption {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long appartmentFeatureOptionId;
private String name;
private BigDecimal value;
}
My database is created at run time, but i get this error
org.hibernate.DuplicateMappingException: Same physical table name [appartment_feature_option] references several logical table names: [AppartmentFeatureOption], [Appartment_AppartmentFeatureOption]
Any idea?
Edit with this code that work
@ManyToMany
@JoinTable(name="appartment_feautre_option_appartment", joinColumns=@JoinColumn(name="appartment_id"), inverseJoinColumns=@JoinColumn(name="appartment_feautre_option_id"))
private List<AppartmentFeatureOption> featureOption;