Hello,
My question is quit simple. Is it possible to create primarey key compounded itself by another composite key and a entity.
I have a table ProductHasOrder (whose pk is order+product+quantity+color), and i would like to create ProductHasOrderHasProductOptions. Then the PK of ProductHasOrderHasProductOptions should be ProductHasOrder + ProductOption
Like that :
Code:
@Entity
@Table(name="Product_has_Orders_has_ProductOption")
@AssociationOverrides({
@AssociationOverride(name = "pk.pho.orders", joinColumns = @JoinColumn(name = "Product_has_Orders_Orders_id")),//Composite key
@AssociationOverride(name = "pk.pho.product", joinColumns = @JoinColumn(name = "Product_has_Orders_Product_id")),//Composite key
@AssociationOverride(name = "pk.pho.quantityProduct", joinColumns = @JoinColumn(name = "Product_has_Orders_quantityProduct")),//Composite key
@AssociationOverride(name = "pk.pho.color", joinColumns = @JoinColumn(name = "Product_has_Orders_color")),//Composite key
@AssociationOverride(name = "pk.productOption", joinColumns = @JoinColumn(name = "ProductOption_id"))//Other entity
})
The error i obtain is a wrong column name.
Code:
Unknown column 'options0_.pho_Orders_id' in 'field list'