ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doopatinagaraju <doopatinagar...@gmail.com>
Subject Passing Array or List to oracle procedure using i battis
Date Thu, 05 Mar 2009 05:41:10 GMT

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
-- 
View this message in context: http://www.nabble.com/Passing-Array-or-List-to-oracle-procedure-using-i-battis-tp22345415p22345415.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message