users@glassfish.java.net

Re: java.lang.ClassCastException OracleCallableStatement in glassfish v31

From: <glassfish_at_javadesktop.org>
Date: Fri, 06 Aug 2010 09:06:10 PDT

Thanks for reply.

Below is our code:

createCallableStatement("{call PKG_WF_DASHBOARD_ROLLING.PRC_INITIAL_CUSTOMER(?,?,?,?,?)}");
                int[] regionIds = formatIdArray(pRegionId, pRegions);
                int[] stateIds = formatIdArray(pStateId, pStates);
                int[] divisionIds = formatIdArray(pDivisionId, pDivisions);
                int[] accountingUnitIds = formatIdArray(pAUId, pAccountingUnits);

                System.out.println("Isnide the DAO pAUId----------"+ pAUId);
                System.out.println("Isnide the DAO ----------"+ accountingUnitIds);

                OracleCallableStatement find = (OracleCallableStatement)getCallableStatement();
                find.setPlsqlIndexTable (1, regionIds, regionIds.length, regionIds.length, OracleTypes.NUMBER, 0); // regions
                find.setPlsqlIndexTable (2, stateIds, stateIds.length, stateIds.length, OracleTypes.NUMBER, 0); // states
                find.setPlsqlIndexTable (3, divisionIds, divisionIds.length, divisionIds.length, OracleTypes.NUMBER, 0); // divisions
                find.setPlsqlIndexTable (4, accountingUnitIds, accountingUnitIds.length, accountingUnitIds.length, OracleTypes.NUMBER, 0); // accountingUnits
                find.registerOutParameter(5, OracleTypes.CURSOR);
                find.executeQuery();


if i remove cast i.e.

//OracleCallableStatement find = (OracleCallableStatement)getCallableStatement();

CallableStatement find = getCallableStatement();
then our code will not work because we are calling find.setPlsqlIndexTable() method which is in OracleCallableStatement class (oracle.jdbc.OracleCallableStatement).

Please help.
[Message sent by forum member 'mohang23']

http://forums.java.net/jive/thread.jspa?messageID=479505