Hi,
I am trying to execute a HQL query
Code:
SELECT COUNT(V.id) FROM Vendor as V LEFT JOIN V.vendorType as VT WHERE V.activeInd='Y'
Hibernate generates the following query
Code:
select
count(vendor0_.ID) as col_0_0_
from
OPDS.VENDOR vendor0_,
OPDS.VENDOR_TYPE vendortype1_ cross
join
OPDS.VENDOR vendor2_
where
vendor0_.VENDOR_TYPE_ID=vendortype1_.ID(+)
and vendor0_.VENDOR_ID=vendor2_.ID
and vendor0_.ACTIVE_IND='Y'
that causes the error in oracle : ORA-25156: old style outer join (+) cannot be used with ANSI joins
Please suggest a solution for this. I don't know why hibernate generates a cross join automatically.
Code:
class Vendor{
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "VENDOR_TYPE_ID")
public VendorType getVendorType() {
return this.vendorType;
}
public void setVendorType(VendorType vendorType) {
this.vendorType = vendorType;
}
}
Code:
class VendorType{
@OneToMany(fetch = FetchType.LAZY, mappedBy = "vendorType")
public Set<Vendor> getVendors() {
return this.vendors;
}
public void setVendors(Set<Vendor> vendors) {
this.vendors = vendors;
}
}