1
我有表 訂單(orderno,訂購日期,suppid) 供應商(suppid,suppname) ORDERDETAILS(orderdetailid,orderno) 如何獲得導致這樣使用JPA orderno,訂購日期,suppname,orderdetailid?如何在單個POJO中添加多個ManyToOne映射並從多個表中獲取記錄?
我有表 訂單(orderno,訂購日期,suppid) 供應商(suppid,suppname) ORDERDETAILS(orderdetailid,orderno) 如何獲得導致這樣使用JPA orderno,訂購日期,suppname,orderdetailid?如何在單個POJO中添加多個ManyToOne映射並從多個表中獲取記錄?
@ManyToOne
@Fetch(FetchMode.JOIN)
@JoinColumn(name="suppid",nullable=false,insertable=false,updatable=false)
private Supplier supplierDetails;
This will Join one table to another and fetch the record for you.This code should be inside Order table POJO. and getter setter of supplier details as well.