我从Oracle默认数据源切换到HikariCP.有一段代码我将自定义Oracle类型传递给存储的参数,并将
java.sql.Connection强制转换为oracle.jdbc.OracleConnection.
try(OracleConnection connection = (OracleConnection) dbConnect.getConnection()) {
try(CallableStatement callableStatement = connection.prepareCall("{? = call pkg_applications.add_application(?,?,?)}")) {
callableStatement.registerOutParameter(1, Types.VARCHAR);
callableStatement.setString(2, form.getPolicyNumber());
callableStatement.setString(3, form.getPolicyStart());
Object[][] uploads = new Object[wrappers.size()][];
for(int i=0; i
uploads[i] = new Object[4];
uploads[i][0] = wrappers.get(i).getName();
uploads[i][1] = wrappers.get(i).getFile().getContentType();
uploads[i][2] = wrappers.get(i).getFile().getSize();
uploads[i][3] = wrappers.get(i).getLocation();
}
callableStatement.setArray(4, connection.createARRAY("T_UPLOAD_FILE_TABLE", uploads));
callableStatement.execute();
int applicationId = callableStatement.getInt(1);
operationResponse.setData(applicationId);
operationResponse.setCode(ResultCode.OK);
}
}
catch(Exception e) {
log.error(e.getMessage(), e);
}
我得到一个java.lang.ClassCastException – com.zaxxer.hikari.pool.HikariProxyConnection无法强制转换为oracle.jdbc.OracleConnection.
如何使用HikariCP将Oracle自定义类型传递给存储过程?