如何在单个POJO中添加Multiple ManyToOne映射并从多个表中获取记录?

时间:2013-08-28 08:06:47

标签: jpa-2.0

我有桌子 令(orderno,订购日期,suppid) 供应商(suppid,suppname) ORDERDETAILS(orderdetailid,orderno) 如何使用JPA orderno,orderdate,suppname,orderdetailid?

获得这样的结果

1 个答案:

答案 0 :(得分:0)

@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.