I'm trying to get a returned value (an Integer value) from a stored function in Oracle 11g.
The function adds 10 to the input number:
FUNCTION ADD_TEN(INPUT IN NUMBER) RETURN NUMBER IS
BEGIN
RETURN INPUT + 10;
END;
In my mapper interface I have the line:
Integer add(Integer input);
And in Xml file
<select id="add" statementType="CALLABLE" resultType='java.lang.Integer'>
{#{output,mode=OUT,jdbcType=NUMERIC,javaType=Integer} = call test_pkg.ADD_TEN(
#{input,jdbcType=NUMERIC}) }
</select>`
The call to the method is like:
Integer sum = mapper.add(45);
But I'm getting the following error:
Could not set property 'output' of 'class java.lang.Integer' with value '55' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'output' in 'class java.lang.Integer'
What am I doing wrong? I'm really lost with this...
Thank you.
Solution: MyBatis return type must be void
. The result parameter I was looking for is in the ResultMap that function/procedure returns.