-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: union all -HQL query problem
PostPosted: Wed Aug 13, 2008 9:27 am 
Newbie

Joined: Fri Jun 27, 2008 12:15 am
Posts: 5
Location: India
String sqlQuery="select pat.outletCode, pa.patientNo,pat.patientDrugRequiredMasterDRDDate, pa.patientNo,pat.drugSlNo,pa.patientName "+
"from PatientDrugRequiredMaster pat,Patient pa where pat.patientNo=pa.patientNo and pat.billMasterSlNo is null and "+
"pat.drugCancel is null and pat.pharmacy.pharmacyCode=:code"+
" UNION ALL "+
"select patDr.outletCode, ip.patient.patientNumber,patDr.patientDrugRequiredMasterDRDDate,ip.patient.patientNumber,patDr.drugSlNo,ip.patientName"+
" from PatientDrugRequiredMaster patDr,IPAdmission ip where patDr.IPAdmission.inPatientNumber=ip.inPatientNumber and patDr.billMasterSlNo is null and"+
" patDr.drugCancel is null and patDr.pharmacy.pharmacyCode=:code and ip.inPatientDISC is null";

Query query = session.createQuery(sqlQuery)
.setParameter("code","I001");


while above query is different on log.debug output- see below
select patientdru0_.OU_CODE as col_0_0_, patient1_.PT_NO as col_1_0_, patientdru0_.DRD_DATE as col_2_0_, patient1_.PT_NO as col_3_0_, patientdru0_.DR_SLNO as col_4_0_, patient1_.PTC_PTNAME as col_5_0_ from PATDRGREQMST patientdru0_, PATIENT patient1_ where patientdru0_.PT_NO=patient1_.PT_NO and (patientdru0_.BMC_SLNO is null) and (patientdru0_.DRC_CANCEL is null) and patientdru0_.PH_CODE=?



here second query is not considering


can anyone help me , to findout whats the problem?


Top
 Profile  
 
 Post subject: Re: union all -HQL query problem
PostPosted: Mon Nov 02, 2009 12:30 am 
Newbie

Joined: Tue Oct 27, 2009 10:20 am
Posts: 3
Hi,

HQL dosent support UNION, UNION ALL so it will get truncated before this function and the second part won't executed, this is occuring for me as well.

if any one knows please help as out.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.