Error on createARRAY method

505 views
Skip to first unread message

hoy

unread,
Jul 31, 2012, 3:23:25 PM7/31/12
to mybati...@googlegroups.com
I am try to pass array of java object to Oracle sql type: here is my code:
------------------------------------
public void setParameter( PreparedStatement ps,  int index,  Object filters, JdbcType type) throws SQLException {
   if(null == filters)
       ps.setNull(index, Types.ARRAY);
   else{
      
            List<ProcessingFilter> lFilters = (List<ProcessingFilter>) filters;              
            ProcessingFilter[] oFilter = new ProcessingFilter[lFilters.size()];              
            for(int i=0; i<oFilter.length; i++){
                oFilter[i] = lFilters.get(i);
            }              
              oracle.jdbc.OracleConnection conn   = (OracleConnection)ps.getConnection(); 
              
                oracle.sql.ARRAY array = conn.createARRAY(FILTER_OBJECT_TABLE, oFilter); //FILTER_OBJECT_TABLE is a static string for oracle object type.
              ps.setObject(index, array, Types.ARRAY);                
                    
   }    
  }
------------------------------------

I got error:
------------------------------------
java.lang.NoSuchMethodError: oracle.jdbc.OracleConnection.createARRAY(Ljava/lang/String;Ljava/lang/Object;)Loracle/sql/ARRAY;
at com.fmr.fas.data.dao.typeHandler.ProcessingFilterTypeHandler.setParameter(ProcessingFilterTypeHandler.java:83)
at org.apache.ibatis.executor.parameter.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:91)
......
------------------------------------

I am using 11g R2, ojdbc6.jar
Any help? thanks

Guy Rouillier

unread,
Jul 31, 2012, 6:08:19 PM7/31/12
to mybati...@googlegroups.com
I found this article with a couple minutes of searching:
http://juca-cruz-utilities.blogspot.com/2010/09/pass-collection-to-stored-procedure.html

Are you sure ojdbc6.jar is on your classpath?
--
Guy Rouillier
Reply all
Reply to author
Forward
0 new messages