0

I'm getting this error at this line:

Object[] results = (Object[])stmt.getArray(1).getArray();

Not sure what it means...

I can show the sql also...can someone explain what this error means...I also have that stac trace if needed

public List<SimilarItemSearchCollectBean> getSimilarItemSearchCollect(
        PagerTagHelper pagerHelper,
        String codes,
        String params[] )
            throws Exception
                {

    if( params.length != codes.length() ) throw new IllegalArgumentException(
                "Number of codes does not match number of parameters: (" +
                codes.length() + " != " + params.length + ")."
                );

            int i = 0;
            String temp = null;
            List<SimilarItemSearchCollectBean> collected = null;
            String funCall = "{ call ? := " + PKG_PREFIX
            + "summarize_item_search_data( ?, ?, ?, ?, ?, ?, ?, ?, ? ) }";

            OracleCallableStatement stmt = null;

            try
            {
                java.util.Map<String,Class<?>> map = connection.getTypeMap();
                map.put( schemaProvider.getSystemSchemaName()+".SIMILAR_ITEM_SEARCH_ROLLUP", SimilarItemSearchCollectBean.class );

                stmt = (OracleCallableStatement)connection.prepareCall( funCall );

                stmt.registerOutParameter(
                1, OracleTypes.ARRAY, schemaProvider.getSystemSchemaName()+".BEAN_LIST" );

                stmt.setInt( 2, pagerHelper.getStartIndex() );
                stmt.setInt( 3, pagerHelper.getEndIndex() );
                stmt.setObject( 4, DAOUtil.getARRAY( DAOUtil.ArrayTypes.CHAR_TAB, pagerHelper.getPropertyNames() ));
                stmt.setObject( 5, DAOUtil.getARRAY( DAOUtil.ArrayTypes.CHAR_TAB, pagerHelper.getSortOrders() ));

                /* Initialize all the parameters to null.
                 * We will re set them individually in the switch if
                 * there is an actual value.
                 */

                stmt.setString( 6, null  );     // value1
                stmt.setString( 7, null  );     // value2
                stmt.setNull( 8, OracleTypes.NUMBER );      // sac
                stmt.setNull( 9, OracleTypes.NUMBER );     // job type id
                stmt.setNull( 10, OracleTypes.NUMBER );  // standard unit price

                // Still need to decide how searching will occur for year ranges
                for( i=0; i<codes.length(); i++ )
                {
                    if ( params[i] != null )
                    {
                        switch( codes.charAt(i) )
                        {
                        case '0':   // VALUE1
                            temp = params[i].replace( '*', '%' );
                            temp = temp.replaceAll("%+", "%");
                            stmt.setString( 6, temp );
                            break;
                        case '1':   // VALUE2
                            stmt.setString( 7, params[i] );
                            break;
                        case '2':   // VALUE3
                            stmt.setInt( 8, Integer.parseInt(params[i]) );
                            break;
                        case '3':   // JOB TYPE ID
                            stmt.setLong( 9, Long.parseLong( params[i] ) );
                            break;
                        case '4':   // VALUE4
                            stmt.setLong( 10, Long.parseLong(params[i]));
                            break;


                        default:

                        } // end switch
                    } // if not null
                } // end for

                stmt.execute();

                // ERROR  HERE:
                Object[] results = (Object[])stmt.getArray(1).getArray();


                collected = new ArrayList<SimilarItemSearchCollectBean>();
                for( i=0; i<results.length; i++ )
                    collected.add( (SimilarItemSearchCollectBean)results[i] );

            } // end try
            finally { close( stmt ); }
            return collected;
        } // end 

1 Answer 1

1

Not familiar with OracleCallableStatement, but shouldn't that be

Object[] results = (Object[])(stmt.getARRAY(1).getArray());

oracle.jdbc.OracleCallableStatement#getARRAY(int) is OracleCallableStatement-specific, getArray() seems to be inherited from java.sql.CallableStatement#getArray(int).

Already said i'm not familiar with this, but getARRAY seems to fit better with the OracleTypes.ARRAY type you registered as out parameter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.