Hi I am facing java.lang.ClassCastException: org.hibernate.engine.jdbc.internal.proxy.CallableStatementProxyHandler cannot be cast to java.sql.CallableStatement while Query.list is executed> I am calling function with 4 IN parameters and returning reference cursor from function. below is code sample for the same, kindly help me HBM file.xml
<sql-query name="sailingschedule" callable="true"> <return alias="vesselvo" class="com.tsi.vo.VesselVO"> <return-property name="pot1_srvc" column="POT1_SRVC"/> <return-property name="pot2_srvc" column="POT2_SRVC"/> <return-property name="pot3_srvc" column="POT3_SRVC"/> <return-property name="pod_srvc" column="POD_SRVC"/> <return-property name="multi_vessels" column="MULTI_VESSELS"/> <return-property name="pod_etd" column="POD_ETD"/> <return-property name="pod_etd_time" column="POD_ETD_TIME"/> </return> {?=call pkg_pc_ref_cursor.prc_retrieve_pair(?,?,?,?)} </sql-query>
call from my action class Query query = session.getNamedQuery("sailingschedule") .setParameter(0,"SGSIN") .setString(1,"THBKK") .setString(2,"20111101") .setString(3,"D");
List lst=query.list();
java.lang.ClassCastException: org.hibernate.engine.jdbc.internal.proxy.CallableStatementProxyHandler cannot be cast to java.sql.CallableStatement org.hibernate.engine.jdbc.internal.proxy.CallableStatementProxyHandler.executeQuery(CallableStatementProxyHandler.java:56) org.hibernate.engine.jdbc.internal.proxy.CallableStatementProxyHandler.continueInvocation(CallableStatementProxyHandler.java:52) org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:80) $Proxy7.executeQuery(Unknown Source) org.hibernate.loader.Loader.getResultSet(Loader.java:1979) org.hibernate.loader.Loader.doQuery(Loader.java:829) org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) org.hibernate.loader.Loader.doList(Loader.java:2449) org.hibernate.loader.Loader.doList(Loader.java:2435) org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276) org.hibernate.loader.Loader.list(Loader.java:2271) org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:331) org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1582) org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:224) org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:156) com.tsi.actions.VslScheduleAction.execute(VslScheduleAction.java:58) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
db function is
function Prc_retrieve_pair(p_pol VARCHAR2, p_pod VARCHAR2, p_date NUMBER,p_tsflag VARCHAR2) return SYS_REFCURSOR is --v_ref_pc_cur_1 ref_pc_cur;
v_ref_pc_cur_1 SYS_REFCURSOR; begin v_ref_pc_cur_1 := fnc_retrieve_pair1(p_pol,p_pod,p_date, '',-- p_cust, '',--p_flag, 3,--p_basis, p_tsflag, '', --p_mode, '', --p_show_afs, '',--p_pot1, '',--p_pot2, '',--p_pot3, '',--p_por_haulage, '',--p_del_haulage, 'N',--p_By_Terminal, p_pol,--p_pol_act, p_pod--p_pod_act ); return v_ref_pc_cur_1;
end;
|