我遇到了@OneToOne單向映射問題。家長PK沒有保存在加入的子欄中。例如customer_payment的invoice_master_id_pay應與CustomerInvoiceMaster的customer_invoice_master一起插入。OneToOne加入專欄問題
這是映射。
@Entity
@Table(name = "customer_invoice_master")
public class CustomerInvoiceMaster {
@Id
private int invoiceMasterId;
// invoice_master_id_pay should be populated with
// CustomerInvoiceMaster customer_invoice_master PK. This is not
// not happening. Row is created with zero value
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "invoice_master_id_pay")
private CustomerPayment customerPayment;
}
@Entity
@Table(name="customer_payment")
public class CustomerPayment{
@Id
private int customerPaymentId;
...
}
謝謝。這就是我之前想的。我同意你的迴應。 –