Table Layout:
TABLE ORDER: id localizedInfoId Table OrderLocalizedInfo: id localizedInfoId name
With the following entities:
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private Long id;
@ManyToMany(
targetEntity=OrderLocalizedInfo.class,
cascade={CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(
name="OrderLocalizedInfo",
joinColumns=@JoinColumn(name="localizedInfoId"),
inverseJoinColumns=@JoinColumn(name="localizedInfoId"))
private List localizedInfos;
}
public class OrderLocalizedInfo {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private Long id;
@Column(name="localizedInfoId")
private Long localizedInfoId;
@Column(name="name")
private String name;
}
I want to map the above situation so that I have a list of OrderLocalizedInfo objects on the order object, using the 'localizedInfoId' field in each table. When I do this I get a mapping exception 'Repeated column mapping for collection Order.localizedInfos column: localizedInfoId.