The issue is a design problem that will eventually be addressed. We have a database view that provides a unified look up table. In the database layer we can assign the pieces individually.
@Entity
public class MainClass {
@OneToMany
@JoinTable(name = "TheViewName",
joinColumns = @JoinColumn(name = "id", insertable = false, updatable= false),
inverseJoinColumns = @JoinColumn(name = "other_id", insertable = false,
updatable = false))
private List<OtherEntity> otherEntities;
}
This means I cannot assign a new other entity to the MainClass and persist both. I have to do two separate operations to get things finalized. But, that will go away when we refactor the schema.
Alternatively, we could create entities for the other two tables to make the operations more transparent.