I have formed HQL like this
select detail from PaymentLedgerDetailDO as detail where detail.id.bankNumber = :bankNumber and ( (detail.id.issueNumber = :iNumber0 and detail.id.paymentDate = :paymentDate0 and detail.id.registerNumber =:registerNumber0 and (detail.mediaNumber is not null or detail.mediaNumber!= ' ' and detail.mediaNumber!='0' ) and (detail.categoryCode is not null or detail.categoryCode!=' ') and (detail.id.nameAddressNumber is not null or detail.id.nameAddressNumber!=' ') and (detail.id.cusipIssueNumber is not null or detail.id.cusipIssueNumber!=' ') and (detail.stopPymtCode!='S' or detail.stopPymtCode is null OR detail.stopPymtCode='')) or (detail.id.issueNumber = :iNumber1 and detail.id.paymentDate = :paymentDate1 and detail.id.registerNumber =:registerNumber1 and (detail.mediaNumber is not null or detail.mediaNumber!= ' ' and detail.mediaNumber!='0' ) and (detail.categoryCode is not null or detail.categoryCode!=' ') and (detail.id.nameAddressNumber is not null or detail.id.nameAddressNumber!=' ') and (detail.id.cusipIssueNumber is not null or detail.id.cusipIssueNumber!=' ') and (detail.stopPymtCode!='S' or detail.stopPymtCode is null OR detail.stopPymtCode='')) ) order by detail.mediaNumber.
While executing query.list() for above hql query oracle is giving "ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT".
After investigating we found that issue is with the SQL query generated by translator. Query Generated
SELECT * FROM PAYMENTLEDGERDETAIL paymentled0_ WHERE paymentled0_.BANK_NUMBER = ? AND paymentled0_.ISSUE_NUMBER = ? AND paymentled0_.PAYMENT_DATE = ? AND paymentled0_.REGISTER_NUMBER = ? AND (paymentled0_.MEDIA_NUMBER IS NOT NULL OR paymentled0_.MEDIA_NUMBER <> ' ' AND paymentled0_.MEDIA_NUMBER <> '0') AND (paymentled0_.CATEGORY_CODE IS NOT NULL OR paymentled0_.CATEGORY_CODE <> ' ') AND (paymentled0_.NAME_ADDRESS_NUMBER IS NOT NULL OR paymentled0_.NAME_ADDRESS_NUMBER <> ' ') AND (paymentled0_.CUSIP_ISSUE_NUMBER IS NOT NULL OR paymentled0_.CUSIP_ISSUE_NUMBER <> ' ') AND (paymentled0_.STOP_PYMT_CODE <> 'S' OR paymentled0_.STOP_PYMT_CODE IS NULL OR paymentled0_.STOP_PYMT_CODE = '') OR paymentled0_.ISSUE_NUMBER = ? AND paymentled0_.PAYMENT_DATE = ? AND paymentled0_.REGISTER_NUMBER = ? AND (paymentled0_.MEDIA_NUMBER IS NOT NULL OR paymentled0_.MEDIA_NUMBER <> ' ' AND paymentled0_.MEDIA_NUMBER <> '0') AND (paymentled0_.CATEGORY_CODE IS NOT NULL OR paymentled0_.CATEGORY_CODE <> ' ') AND (paymentled0_.NAME_ADDRESS_NUMBER IS NOT NULL OR paymentled0_.NAME_ADDRESS_NUMBER <> ' ') AND (paymentled0_.CUSIP_ISSUE_NUMBER IS NOT NULL OR paymentled0_.CUSIP_ISSUE_NUMBER <> ' ') AND (paymentled0_.STOP_PYMT_CODE <> 'S' OR paymentled0_.STOP_PYMT_CODE IS NULL OR paymentled0_.STOP_PYMT_CODE = '')
This query being executed is fetching large data because of missing brackets.
Actually expected query is select * from PAYMENTLEDGERDETAIL paymentled0_ where (paymentled0_.BANK_NUMBER=? ) and (((paymentled0_.ISSUE_NUMBER=? ) and (paymentled0_.PAYMENT_DATE=? ) and (paymentled0_.REGISTER_NUMBER=? ) and ((paymentled0_.MEDIA_NUMBER is not null ) or (paymentled0_.MEDIA_NUMBER!=' ' ) and (paymentled0_.MEDIA_NUMBER!='0' )) and ((paymentled0_.CATEGORY_CODE is not null ) or (paymentled0_.CATEGORY_CODE!=' ' )) and ((paymentled0_.NAME_ADDRESS_NUMBER is not null ) or (paymentled0_.NAME_ADDRESS_NUMBER!=' ' )) and((paymentled0_.CUSIP_ISSUE_NUMBER is not null ) or (paymentled0_.CUSIP_ISSUE_NUMBER!=' ' )) and((paymentled0_.STOP_PYMT_CODE!='S' ) or (paymentled0_.STOP_PYMT_CODE is null ) OR (paymentled0_.STOP_PYMT_CODE='' ))) or ((paymentled0_.ISSUE_NUMBER=? ) and (paymentled0_.PAYMENT_DATE=? ) and (paymentled0_.REGISTER_NUMBER=? ) and ((paymentled0_.MEDIA_NUMBER is not null ) or (paymentled0_.MEDIA_NUMBER!=' ' ) and(paymentled0_.MEDIA_NUMBER!='0' )) and ((paymentled0_.CATEGORY_CODE is not null ) or(paymentled0_.CATEGORY_CODE!=' ' )) and ((paymentled0_.NAME_ADDRESS_NUMBER is not null ) or (paymentled0_.NAME_ADDRESS_NUMBER!=' ' )) and ((paymentled0_.CUSIP_ISSUE_NUMBER is not null ) or(paymentled0_.CUSIP_ISSUE_NUMBER!=' ' )) and ((paymentled0_.STOP_PYMT_CODE!='S' ) or (paymentled0_.STOP_PYMT_CODE is null ) OR (paymentled0_.STOP_PYMT_CODE='' )))) order by paymentled0_.MEDIA_NUMBER.
|