Hi ,
I am working on spring and hibernate.I wrote a HQL query to fetch data which has a inner query.This is executing twice , suppose total records are 10 ,It's displaying 20(duplicate records).
If number of inner queries increasing , the execution will also increse.
When a statement
getHibernateTemplate.find(query.toString) comes .here only it executes multiple times.
If you take one query and execute it will work fine.
I am using parameterised constructor.
Please tell me it is problem of mapping files or query.
[code]
StringBuffer brokerSummary = new StringBuffer("SELECT DISTINCT NEW com.reuters.tops.vo.view.RTEXViewVO");
brokerSummary.append("(ORG.organisationId , ORG.orgFullName ,");
//Taker Approved Organisations
brokerSummary.append(" (select count(*) from OrgApprovalVO as orgapproval,ApprovalVO as approval ");
brokerSummary.append(" where approval.requestId = orgapproval.requestId and ");
brokerSummary.append(" productdetails.queueOrganisationVO.organisationId = approval.apprOrgId and ");
brokerSummary.append(" orgapproval.statusId = 15 ))");
brokerSummary.append(" From QueueOrganisationVO as ORG,QueueProductDetailsVO as productdetails where ");
brokerSummary.append(" ORG.organisationId = productdetails.queueOrganisationVO.organisationId and ");
brokerSummary.append(" productdetails.queueOrganisationTypeVO.orgTypeId = 2 and ");
brokerSummary.append(" productdetails.productId = 1");
return getHibernateTemplate().find(brokerSummary.toString());
|