I may just be misunderstanding how @JoinColumns work, but I'm getting an error when I reuse the name attribute. But doesn't the name attribute map to a database column? Shouldn't I be able to reuse it?
There error I'm getting:
Repeated column in mapping for entity: data.model.DP column: division
The code:
@Column(name = "division", nullable = false)
private String division;
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumns({
@JoinColumn(name = "division_labeldefintion", referencedColumnName = "labeldefinition"),
@JoinColumn(name = "division", referencedColumnName = "abbr")
})
private LabelFile divisionLabel;
What I'm trying to do is do a multi-column join from one table (which contains the division
column, and join it with the LabelFile
table.