Hi, I try to use (OracleCallableStatement), but got the following error. It seems the case is still fail. And I also use "OracleConnection conn = (OracleConnection) session.connection();", but it got $ProxyXX error too.
Code:
org.hibernate.SessionFactory sessionFactory = getHibernateTemplate().getSessionFactory();
org.hibernate.Session session = sessionFactory.openSession();
String[] javaArray1 = {"AAAA","BBB"};
OracleCallableStatement stmt = (OracleCallableStatement) session.connection().prepareCall("SELECT * FROM table WHERE name IN (SELECT * FROM TABLE (CASE(? as NAME_LIST)) )");
ArrayDescriptor oracleCollection = ArrayDescriptor.createDescriptor("NAME_LIST", stmt.getConnection());
ARRAY jdbcArray1 = new ARRAY(oracleCollection, stmt.getConnection(), javaArray1);
stmt.setObject(1, jdbcArray1);
ResultSet r = stmt.executeQuery();
while(r.next()){
System.out.println("OUTPUT: " + r.getString(1));
}
Error message:
[ERROR] RuntimeException Error Message : org.apache.commons.dbcp.DelegatingCallableStatement
java.lang.ClassCastException: org.apache.commons.dbcp.DelegatingCallableStatement
at com.test.webservice.fun1.getPartStatus(PartInfoDAOImpl.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3395)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)