I have to 2 objects: Purchase Orders and Items
i would like to create constraint between those class to Items.class with companyId and itemsCode but those columes are seperated into two classes.
what can be a solution for that ?
posted 7 years ago
You you want to create a constraint on the database, or a OneToOne mapping in JPA?
A OneToOne mapping should work, but your Item must define an Id, (both companyId and itemCode should be its Id).
Then you can define a normal OneToOne in PerchaseOrderLine to Item,