class Transaction implements Serializable {
@OneToOne(mappedBy = "transaction")
@JoinColumn(name = "invoice_id", nullable = false)
private InvoiceDetails invoice;
// some other columns, getter and setter
}
class InvoiceDetails implements Serializable {
@OneToOne(mappedBy = "invoice", fetch = FetchType.LAZY)
@JoinColumn(name = "transaction")
private Transaction transaction;
// some other column and getter setter
}
编译时出现错误 - Unknown mappedBy in: com.project.model.Transaction.invoice, referenced property unknown: com.project.model.InvoiceDetails.transaction
但是,当我mappedBy = "invoice"从 InvoiceDetails 中删除 时,它会编译。但是,交易表中有一列引用了 InvoiceDetails。InvoiceDetails 中有一个列用于存储交易中的 Id。
我还没有尝试获取数据。我现在只看到数据库中的列。
慕村225694
相关分类