Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Unanswered: Passing an Array to oracle procedure using ibattis

    this is nagarju, from 4 days on wards iam trying to sort out the problem which i got , that is sending an array to stored procedure using i battis, please help me, following is my code.

    public List<Customer> getGrid()
    {
    List<Customer> listCus = new ArrayList<Customer>();
    try {

    Connection conn = sqlMap.getDataSource().getConnection();
    OracleConnection oconn = (OracleConnection)conn.getMetaData().getConnection ();
    java.sql.Array sqlArray = null;
    int intArray[] = { 1,2,3,4,5,6 };
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("NUM_ARRAY", oconn );
    ARRAY array = new ARRAY(descriptor,oconn,intArray);
    sqlArray = new oracle.sql.ARRAY(descriptor,oconn,intArray);
    HashMap map = new HashMap();
    map.put("organization","%gln%");
    map.put("integertArray",array);
    //map.put("integertArray",sqlArray);
    Customer cust =new Customer();

    sqlMap.queryForObject("langSqlMap.getGridProc",map );
    listCus=(List)map.get("custRecords");

    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    System.out.println("error----------"+e);

    }


    return listCus;
    }



    <parameterMap id="getGridCustomer" class="java.util.HashMap">
    <parameter property="organization" javaType="java.lang.String" jdbcType="varchar2" mode="IN" />
    <parameter property="integertArray" javaType="java.sql.Array" jdbcType="oracle.sql.ARRAY" mode="IN" typeName="OracleTypes.ARRAY" />
    <parameter property="custRecords" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT" resultMap="getGridCustomerResultMap"/>
    </parameterMap>



    <procedure id="getGridProc" parameterMap="getGridCustomer" >
    {call getGrid_proc(?,?,?)}
    </procedure>

    procedure-----------------
    create or replace procedure getGrid_proc(p_organization in varchar2,
    v_List in NUM_ARRAY,
    p_resultSet out sys_refcursor) is

    NumArray is type table Number in schemalevel

    iam getting exception while debugging


    com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
    --- The error occurred in /SQLCONFIG/languagesqlmap.xml.
    --- The error occurred while applying a parameter map.
    --- Check the langSqlMap.getGridCustomer.
    --- Check the parameter mapping for the 'integertListObj' property.
    --- Cause: java.lang.NullPointerException

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You'd probably do better in an iBATIS forum. Looks like Greek to me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •