2

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"),
dcsohl
  • 7,186
  • 1
  • 26
  • 44
Mohit Singh
  • 5,977
  • 2
  • 24
  • 25
  • Why didn't it work? What happened, and what did you expect to happen? How did you use the named query? (Note: around here, just saying "it didn't work" is never acceptable - you have to say in what way it didn't work, or nobody can possibly help you.) – dcsohl Sep 28 '16 at 13:55
  • ye possibly the error is `NoSuitableConstructorFound` for the Custom Object to get the Result Set – AntJavaDev Sep 28 '16 at 14:03
  • I am not able to convert above mentioned problem to named query may be the joins that are creating some problem its giving syntax is not correct but i am not able to find any error in syntax. :( – Mohit Singh Sep 28 '16 at 14:13
  • @dcsohl instead of criticizing someone you should focus on giving answer and if you don't feel like giving answers then please let other people help. – Mohit Singh Dec 06 '16 at 07:19
  • Asking for clarification is not criticism. (Well, OK, it's constrictive criticism.) You have not given me any way to replicate your problem, so it's unlikely anybody can possibly help you unless you actually say what the error is. In over two months nobody has even attempted to answer in part because you never said what the actual error was. You should review [How To Ask A Good Question](http://stackoverflow.com/help/how-to-ask). – dcsohl Dec 06 '16 at 12:00
  • i THINK YOU HAVENOT GOT THE CRUX OF MY LAST REPLY PLEASE READ IT ONCE AGAIN – Mohit Singh Dec 08 '16 at 14:34

0 Answers0