I've been through the user guide and the test cases but don't see a good
example of doing an insert or update with a Object using a annotation

 

e.g.

 

@Update("INSERT INTO foo (bar_1, bar_2) VALUES (#{bar1}, #{bar2})")

void update(SomeObject obj);

 

What am I missing?

 

-Doug

 

From: Anta [mailto:antan...@gmail.com] 
Sent: Wednesday, August 26, 2009 2:35 AM
To: user-java@ibatis.apache.org
Subject: Calling oracle procedure from Java using iBatis

 

 
Hi All,
 
I have a stored procedure as like below in oracle db
 
 
create or replace PROCEDURE employee_to_delete (i_condition VARCHAR2)
   IS
      TYPE r_cursor IS REF CURSOR;
 
      actiontype                    VARCHAR2 (20)         := 'DELETING';
      del_cur_temp                  r_cursor;
      cursor_table                  employee%ROWTYPE;
      sql_stmt                      VARCHAR2 (10000);
   BEGIN
     
      sql_stmt := 'select *  from employee ' || i_condition;
 
      OPEN del_cur_temp FOR sql_stmt;
 
      LOOP
         FETCH del_cur_temp
          INTO cursor_table;
 
         DELETE FROM employee
               WHERE name = cursor_table.name
                 AND no = cursor_table.no
                 AND dept = cursor_table.dept;
 
         EXIT WHEN del_cur_temp%NOTFOUND;
      END LOOP;
      commit;
   END;
 
 
I have add the following line in my sql map file
 
             
               
        
 
And I tried to execute the same using the following java code
 
String str= "pavan";
               sqlMap.queryForObject("deleteUser",str);
 
 
The records are deleted successfully. After that I am getting the
exception like below.
 
Exception in thread "main"
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in SqlMap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the deleteUser-InlineParameterMap.  
--- Check the output parameters.  
--- Cause: java.lang.ArrayIndexOutOfBoundsException: 0
        at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryW
ithCallback(MappedStatement.java:204)
        at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryF
orObject(MappedStatement.java:120)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlM
apExecutorDelegate.java:518)
        at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlM
apExecutorDelegate.java:493)
        at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSes
sionImpl.java:106)
        at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClie
ntImpl.java:82)
        at Main.main(Main.java:16)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at
com.ibatis.sqlmap.engine.exchange.PrimitiveDataExchange.setData(Primitiv
eDataExchange.java:51)
        at
com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.refreshParameter
ObjectValues(ParameterMap.java:141)
        at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.postProces
sParameterObject(ProcedureStatement.java:26)
        at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryW
ithCallback(MappedStatement.java:193)
        ... 6 more
 
Please any one explain me why this exception occurs also how to solve
it.
 
Thanks in Advance
Ant

 

________________________________

View this message in context: Calling oracle procedure from Java using
iBatis
<http://www.nabble.com/Calling-oracle-procedure-from-Java-using-iBatis-t
p25149496p25149496.html> 
Sent from the iBATIS - User - Java mailing list archive
<http://www.nabble.com/iBATIS---User---Java-f370.html>  at Nabble.com.

Reply via email to