You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Alex Sherwin <al...@acadiasoft.com> on 2009/02/25 16:55:07 UTC

Problem with Stored Procedure OUT/INOUT not working for a parameter that is not at root-level of the parameter

I'm observing behavior such that, say:

<procedure id=".." paramaterClass="java.util.Map">
  { CALL $schema$.MY_PROCEDURE(
        
#someRootValue1,javaType=java.lang.String,jdbcType=VARCHAR,mode=INOUT,
        #someRootValue2,javaType=java.lang.Long,jdbcType=BIGINT,mode=INOUT,
        
#someObj.someSubValue1,javaType=java.lang.Long,jdbcType=BIGINT,mode=INOUT,
        
#someObj.someSubValue2,javaType=java.lang.String,jdbcType=VARCHAR,mode=INOUT 
) }
</procedure>

- someRootValue 1 and 2 can work fine this way,  being at the "root" 
level of the Map parameter Object
- someObj.someSubValue2 works fine as an INOUT or OUT parameter (because 
it is a String)

However, trying to use someObj.someSubValue1 as an INOUT or OUT 
parameter throws:
java.sql.SQLException: Incorrect integer value: 'null' for column 
'DETAIL_ID' at row 1.

Note that "DETAIL_ID" is merely the name of the INOUT parameter in the 
stored procedures parameter list.

If I simply change this to be an IN parameter in both the stored 
procedure definition and the SqlMap, the exception goes away and the 
parameter is passed into the stored procedure without any problem.

Using the exact same parameter as an INOUT in the stored procedure, but 
instead mapping it to a value in my parameter Map Object that is at the 
root level of the map (an actual member of the map, as opposed to a 
property on an Object in the map) works fine.

Is what I'm trying to do unsupported by iBatis?  I'm confused, because 
this is only happening to types that can be auto-boxed (java.lang.Long 
-> BIGINT in this case).  I can do what I want with a String -> VARCHAR etc.

Note that my java types are all defined using the Object variants 
(java.lang.Long etc, as well as mapped this way in the SqlMap files)