Is there a way to make a query in jpa/hibernate with a left join on two columns, like the following in plain sql?
Code:
select
combinedin1_.SHIPMENTNUMBER ,
shipmentin3_.INBOUNDDELIVERYITEM ,
combinedin1_.PURCHASEORDERNUMBER,
combinedin1_.PURCHASEORDERITEMNUMBER ,
purchaseor2_.FACTORY
from
REPORT.REPORTLINK this_
left outer join
REPORT.COMBINEDINFO combinedin1_
on this_.COMBINEDINFOID=combinedin1_.COMBINEDINFOID
left outer join
REPORT.PURCHASEORDERINFO purchaseor2_
on this_.PURCHASEORDERINFOID=purchaseor2_.PURCHASEORDERINFOID and purchaseor2_.DELETED='N'
left outer join
REPORT.SHIPMENTINFO shipmentin3_
on this_.SHIPMENTINFOID=shipmentin3_.SHIPMENTINFOID and shipmentin3_.DELETED='N'
More specific this is the left join written in plain sql:
Code:
left outer join
REPORT.SHIPMENTINFO shipmentin3_
on this_.SHIPMENTINFOID=shipmentin3_.SHIPMENTINFOID and shipmentin3_.DELETED='N'
This is my reportLink entity in JPA:
Code:
@Entity
@Table(name = "REPORTLINK") public class ReportLinkFull implements Serializable {
private static final long serialVersionUID = -2330676941570524461L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "REPORTLINKID")
private Integer id;
@ManyToOne
@JoinColumn(name = "SALESORDERINFOID")
private SalesOrderInfo salesOrderInfo;
@ManyToOne
@JoinColumn(name = "PURCHASEORDERINFOID")
private PurchaseOrderInfo purchaseOrderInfo;
@ManyToOne
@JoinColumn(name = "SHIPMENTINFOID")
private ShipmentInfo shipmentInfo;
@ManyToOne
@JoinColumn(name = "MATERIALINFOID")
private MaterialInfo materialInfo;
@ManyToOne
@JoinColumn(name = "CUSTOMERINFOID")
private CustomerInfo customerInfo;
@ManyToOne(cascade={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE})
@JoinColumn(name = "COMBINEDINFOID")
private CombinedInfo combinedInfo;
@Version
private Integer version;
}
Thanks