1
我有一個HQL展示間(TO_DATE)根據我的數據,但我得到Could not locate named parameter
錯誤無法找到名爲參數
這是我的代碼
SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy");
Date date1 = Calendar.getInstance().getTime();
String tgl1 = sdf1.format(date1);
String Tanggal_awal = tgl1+" 00:00:00";
System.out.println(Tanggal_awal);
SimpleDateFormat sdf2 = new SimpleDateFormat("dd-MM-yyyy");
Date date2 = Calendar.getInstance().getTime();
String tgl2 = sdf2.format(date2);
String Tanggal_akhir = tgl2+" 23:59:59";
System.out.println(Tanggal_akhir);
Query LoadSource = session_source.createQuery("select CLIENT,SERVICE,SERVICE_TYPE,PROVIDER_CODE,COUNT(*) FROM SwitcherServiceSource" +
" where TIMESTAMP between to_date(':awal','dd-MM-yyyy HH24:MI:SS') and to_date(':akhir','dd-MM-yyyy HH24:MI:SS')" +
" and PROVIDER_CODE is not null group by CLIENT,SERVICE,SERVICE_TYPE,PROVIDER_CODE order by CLIENT,SERVICE,SERVICE_TYPE,PROVIDER_CODE");
LoadSource.setParameter("awal", Tanggal_awal);
LoadSource.setParameter("akhir", Tanggal_akhir);
任何幫助將是快樂:)
whoaaahhhh解決了,感謝花花公子;)) –
不,精湛的意見..... mega謝謝你,夥計,我會試試它:) –