Inside MySQL i created some tables. I have a table user who contains all the items. But now i want to make an estimate who has a list of items. from the tbl_items.
So i MySql i did something like this:
But now if i have trouble with the mapping of the list items:
This is my estimate class :
@Entity
@Table(name = "tbl_estimate")
@SecondaryTable(name = "tbl_order_items", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "fk_id_estimate_order", referencedColumnName = "id_estimate")})
public class Estimate {
//Table estimate
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id_estimate",table = "tbl_estimate")
private Integer id ;
@Column(table = "tbl_estimate")
private Integer fkIdUserEstimate;
@Column(table = "tbl_estimate")
private Integer fkIdClientEstimate;
//table order items
@Column(table = "tbl_order_items")
@OneToMany(fetch = FetchType.LAZY, mappedBy = "fk_id_estimate_order", cascade = CascadeType.ALL)
@Fetch(FetchMode.JOIN)
private List<Item> itemList = new ArrayList<>();
....
Can someone give me some directions on this ?
