I have to 2 objects: Purchase Orders and Items
i would like to create constraint between ELCWEB.ELC_PO_LINES to Items.class with companyId and itemsCode but those columns are separated into two classes.
what can be a solution for that ?
Code:
1. @Entity
2. @Table(name = "ELCWEB.ELC_PO_LINES")
3. public class PerchaseOrderLines {
4.
5. @EmbeddedId
6. public PerchaseOrderLinesPK perchaseOrderLinesPK;
7.
8. @Column(name="POL_ITEM_CODE")
9. private String itemCode;
10.
11. }
12.
13. @Embeddable
14. public class PerchaseOrderLinesPK implements Serializable {
15.
16. private static final long serialVersionUID = -2968018113431114592L;
17.
18. @Column(name = "POH_PO_NUM")
19. private String poNum;
20.
21. @Column(name="COMPANY_ID")
22. private Integer companyId;
23. }
24. @Entity
25. public class Items {
26. @Column(name = "COMPANY_ID")
27. private String companyId;
28.
29. @Column(name = "ITEM_CODE")
30. private String itemCode;
31. }