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?
|