What would be the Named Query for Following sql statement? I am using hibernate JPA
Select f.FUND_MGMT_CO_CD, f.FUND_CD, S.HOLDING_EN_NAME,
S.HOLDING_FR_NAME, c.FUND_MKT_TRAX_CD, T.PORTFOLIO_DT, T.SEC_PCT from
IPD_FUND_T f inner join IPD_Top_Ten_Hold_T t on f.FUND_MGMT_CO_CD =
t.FUND_MGMT_CO_CD and f.FUND_CD = t.FUND_CD inner join
IPD_SECURITY_REP_T s on s.SECUR_ID = t.SECUR_ID inner join
IPD_FUND_SALES_CHARGE_T c on f.FUND_MGMT_CO_CD = c.FUND_MGMT_CO_CD and
f.FUND_CD = c.FUND_CD where PORTFOLIO_DT =
TO_DATE('30/06/2015','DD/MM/YY')
I am new to named queries, i tried to find absolute solution for the above query but it didn't worked.
Solution that didn't worked were
@NamedQuery(name = "findTopTenHoldingsNew", query = "select new map(fund.id.fundMgmtCoCd as fund_mgmt_co_cd, "
+ " fund.id.fundCd as fund_cd, sec.holdingEnName as holding_en_name, sec.holdingFrName as holding_fr_name, charge.id.fundMktTraxCd as fund_mkt_trax_cd, topten.secPct as sec_pct)"
+ " from IpdFundT as fund,"
+ " IpdTopTenHoldT as topten, "
+ "IpdSecurityRepT as sec, "
+ "IpdFundSalesChargeT as charge "
+ " inner join fund.id.fundMgmtCoCd as topten.id.fundMgmtCoCd and fund.id.fundCd as topten.id.fundCd "
+ " inner join sec.secureId as topten.id.secureId "
+ " inner join fund.id.fundMgmtCoCd as charge.id.fundMgmtCoCd and fund.id.fundCd as charge.id.fundCd "
+ " WHERE topten.id.portfolioDt = :portfolioDt "
+ " order by fund.id.fundCd desc"),