I've come across the same issue when trying to create a Oracle User Defined Array via the ArrayDescriptor. The issue is that the Connection object returned by Jboss is a WrappedConnection.
One possible way to resolve the issue is by doing something like the following:
WrappedConnection.getUnderlyingConnection() . This will require importing (include jboss-common-jdbc-wrapper.jar with WrappedConnection class).
A better way, which I'm looking for, is to somehow configure jboss to give me an OracleConnectionPool directly like it does in tomcat by configuring the server.xml like so:
name="jdbc/my_jndi_name" auth="Container" type="oracle.jdbc.pool.OracleDataSource" factory="oracle.jdbc.pool.OracleDataSourceFactory"
maxActive="20" maxIdle="10" maxWait="10000"
url="jdbc:oracle:thin:@my_db_url:1521:my_db" user="user" password="pw" connectionCachingEnabled="true"
Does anybody know how to configure Jboss to expliclty return an OracleDataSource? I've looked over all the jboss documentation and don't see any attribute to do something similar to the fix above for Tomcat?
Thanks in advance,
I had the same problem in the last week, and found the solution,
The ArrayDescriptor and ARRAY needed a Native Connection, and the mode to get this is:
cstmt = (OracleCallableStatement) getSession().connection().prepareCall(" call REP_UPDATE_STOCK_WAREHOUSE(?, ?, ?, ?, ?) ");
ArrayDescriptor descCE = ArrayDescriptor.createDescriptor("NUMBER_NT", cstmt.getConnection());
A OracleCallableStatement.getConnection returns a Native Connection... use that for parameter the ArrayDescriptor.createDescriptor and the ClassCastException will solve.