It is working now but the primary key should have been a composite key of managerId & yearDepartmentId
I had to battle with it a bit but adding updatable = false, insertable = false fixed it.
@Id @GeneratedValue @Column(name="Manager_Id") private int managerId;
@ManyToOne @JoinColumns( { @JoinColumn(name = "Manager_Id", referencedColumnName = "Manager_Id", updatable = false, insertable = false) }) private Manager manager;
@Column(name="Year_Department_Id") private int yearDepartmentId;
@ManyToOne @JoinColumns( { @JoinColumn(name = "Year_Department_Id", referencedColumnName = "Year_Department_Id", updatable = false, insertable = false) }) private YearDepartmentId yearDepartmentId;
|