-->
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: Registering out paramters in hibernate
PostPosted: Fri Jan 20, 2012 8:35 am 
Newbie

Joined: Fri Jan 20, 2012 8:30 am
Posts: 1
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;


Top
 Profile  
 
 Post subject: Re: Registering out paramters in hibernate
PostPosted: Wed Jul 30, 2014 12:45 pm 
Newbie

Joined: Wed Jul 30, 2014 12:22 pm
Posts: 1
i am also facing same problem.. Please let me know if u solved this issue.. In my local it working file.. But when its deployed in higher environment. i have found that Jboss version are different (in local - 7.1.1 and higher env - 7.0.1)


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.