ClassCastException ArrayDescriptor SructDescriptor
Hi,
I have problem with calling stored procedure in oracle.
One of the IN parameters of the procedure is Array, and when I try to call this procedure I get error:
java.lang.ClassCastException: oracle.sql.StructDescriptor cannot be cast to oracle.sql.ArrayDescriptor
Code in PL/SQL:
CREATE OR REPLACE
type A_TYPE as OBJECT (
firstName varchar2(100),
surname varchar2(100)
);
CREATE OR REPLACE
type A_TYPE_ARRAY is table of A_TYPE;
Code in java:
String function ="xxxxxxxxxx";
OracleCallableStatement cstmt = (OracleCallableStatement)conn.prepareCall(funkcion);
OracleConnection conn = (OracleConnection)DriverManager.getConnection
("jdbc:oracle:thin:@xxxx:1521:xxxxx", "xxx", "xxx");
Object[] atr = new Object[];
StructDescriptor structdesc = StructDescriptor.createDescriptor("A_TYPE", conn);
STRUCT struct = new STRUCT(structdesc, conn, atr);
ArrayDescriptor arrayDesc = ArrayDescriptor.createDescriptor("A_TYPE_ARRAY", conn);
ARRAY array = new ARRAY(arrayDesc, conn, struct);
cstmt.setArray(1, array);
cstmt.execute();
In line where I trying to make arrayDesc I get error:
Exception occurred during event dispatching:
java.lang.ClassCastException: oracle.sql.StructDescriptor cannot be cast to oracle.sql.ArrayDescriptor
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:112)
Can some tell me what causes this problem?
Thanks.