Hello, I’m newbie in this, so there are questions in the description of the relationship between entities! How do I correctly describe the connection that is shown in the diagram:
I tried this way:
@Table(name = "TABLE_2")
@Entity(name = "TABLE2")
public class Table2 {
@Id
@Column(name = "TBL_2_ID")
private Long tbl2_id;
@OneToMany(mappedBy = "tbl2")
private List<Table1> tables;
@Column(name = "CODE")
private String code;
...
}
@Table(name = "TABLE_1")
@Entity(name = "TABLE1")
public class Table1 {
@Id
@Column(name = "TBL_1_ID")
private Long tbl_id;
@manyToOne(fetch = FetchType.LAZY)
@joinColumn(name = "TBL_2", referencedColumnName = "CODE")
private Table2 tbl2;
...
}
But as a result, the application started reporting that entities were incorrectly described.
Please help me to solve this problem