PublicList getquerylist (Map parammap,intStartintMaxResults)throwsDataAccessException, Hibernateexception, Instantiationexception, Illegalaccessexception, InvocationTargetE Xception, nosuchmethodexception {String Wono= ""; String Wosubject= ""; Date Creationdatefrom=NULL; Date Creationdateend=NULL; if(Parammap.get ("Wono")! =NULL) {Wono= (String) parammap.get ("Wono"); } ; if(Parammap.get ("Wosubject")! =NULL) {Wosubject= (String) parammap.get ("Wosubject"); } if(Parammap.get ("Creationdatefrom")! =NULL) {Creationdatefrom= (Date) parammap.get ("Creationdatefrom"); } if(Parammap.get ("Creationdateend")! =NULL) {Creationdateend= (Date) parammap.get ("Creationdateend"); } stringbuffer buf=NewStringBuffer (); Buf.append ("Select Abh.*,"); Buf.append ("Fw.wo_no Bill_code,"); Buf.append ("Fw.wo_type Bill_type,"); Buf.append ("Fw.wo_subject Bill_title,"); Buf.append ("Fw.created_date creation_date,"); Buf.append ("Fw.process_instance_id process_instance_id,"); Buf.append ("' transated ' Task_type,"); Buf.append ("(select Au.user_name from Arch_user au where au.user_id=abh.created_by) created_name,"); Buf.append ("(select Ao.org_name from arch_org ao where ao.org_id=abh.arch_org_company_id) region_company_segment,"); Buf.append ("(select Ao.org_name from arch_org ao where ao.org_id=abh.arch_org_dept_id) region_dept_segment"); Buf.append ("From Fas_workorder FW, Account_bill_head ABH where 1 = 1"); Buf.append ("And Fw.businessid = abh.account_bill_head_id"); Buf.append ("And Fw.wo_no Like:wono"); Buf.append ("And Fw.wo_subject Like:wosubject"); Buf.append ("And Fw.created_date between NVL (: Creationdatefrom,fw.created_date) and NVL (: creationdateend,sysdate)"); Buf.append ("ORDER BY fw.created_date Desc"); List beanlist=NULL; Session Session=NULL; Try{Session=accountbillheaddao.gethibernatetemplate (). Getsessionfactory (). Opensession (); //get local SQL query ObjectSQLQuery query =Session.createsqlquery (buf.tostring ()); //Setting String ParametersQuery.setstring ("Wono", "%" + Wono + "%"); Query.setstring ("Wosubject", "%" + wosubject + "%"); //Set Date ParametersQuery.setdate ("Creationdatefrom", Creationdatefrom); Query.setdate ("Creationdateend", Creationdateend); //Set Page PagingQuery.setfirstresult (start); Query.setmaxresults (MaxResults); Query.setresulttransformer (NewExtcolumntobean (Accountbillheadvoimpl.class)); Beanlist=query.list (); } Catch(RuntimeException e) {//TODO auto-generated Catch blockE.printstacktrace (); } finally{Session.flush (); Session.close (); } returnbeanlist; }