我在oracle9i里写好了存储过程,定义了一个type,代码如下:
public String saveClob(Object bean, String clobStr, String sqlName)
throws CommonException {
String sql;
Connection conn = null;
CallableStatement ps = null;
try {
conn = DataSourceUtils.getConnection(this.getDatasource());
sql = PropertiesSupply.getProperty("sql", sqlName, "");
CLOB clob = CLOB.createTemporary(((WrappedConnection) conn)
.getUnderlyingConnection(), false, CLOB.DURATION_CALL);
Writer out = clob.getCharacterOutputStream();
out.write(clobStr);
out.flush();
out.close();
ps = conn.prepareCall(sql);
ps.setObject(1, bean, OracleTypes.JAVA_STRUCT);
//ps.setClob(2, clob);
//ps.execute();运行到CLOB clob = CLOB.createTemporary(((WrappedConnection) conn)
.getUnderlyingConnection(), false, CLOB.DURATION_CALL);
的时候就报错了,错误代码如下:
java.lang.ClassCastException: oracle.jdbc.internal.OracleConnection$$EnhancerByCGLIB$$f55c0843
at com.mrmoney.dao.Impl.CommonDAO.saveClob(CommonDAO.java:231)
at com.mrmoney.dao.Impl.NewsImpl.newNews(NewsImpl.java:46)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy3.newNews(Unknown Source)
at com.mrmoney.servlet.NewsAdmin.doPost(NewsAdmin.java:154)请问有人知道是什么原因吗