Order and OrderPayment is one to many.
@OneToMany(targetEntity = OrderPaymentImpl.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@ElementJoinColumn(name = ORDER_UID, nullable = false, updatable = false)
@ElementForeignKey
@ElementDependent
@OrderBy
public SetgetOrderPayments() {
return this.orderPayments;
}
nullable=false, updatable=false means the field in table OrderPayment should not be null, should not be updated when the order is updated. Without this on foreign key may cause dead lock on database.
No comments:
Post a Comment