Quantcast

How to call function with DML and without Parameters?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to call function with DML and without Parameters?

Tyrion
I need to invoke a Oracle function that has DML inside and the function dont have parameters.

I tried something like that


    <parameterMap type="com.myCompany.myObject" id="myMap">
        <parameter property="myPropertie" javaType="java.lang.Integer" jdbcType="NUMERIC" mode="OUT"/>
    </parameterMap>

<select id="callFunction"  parameterMap="myMap" statementType="CALLABLE">
    { ? = CALL fnc_myFunction }
</select>



But... I has an error.

### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property '
myPropertie' of 'class org.apache.ibatis.reflection.MetaObject$NullObject' with value '24272' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'myPropertie' in 'class java.lang.Class'
### The error may involve myMapper.
myMap
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property '
myPropertie' of 'class org.apache.ibatis.reflection.MetaObject$NullObject' with value '24272' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'myPropertie' in 'class java.lang.Class'

I'm working with JBOSS and Mybatis 3.0.6, I'm sure MyObject has  "public set
MyPropertie(Integer xxx)"

Thanks in Advance

   
   





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to call function with DML and without Parameters?

demosfen
I tried this and it worked fine:
<parameterMap type="...mapper.SystemMapper$CallParam" id="callParam">
<parameter property="dbId" jdbcType="INTEGER" mode="OUT" javaType="_int"/>
</parameterMap>
<update id="getDbIdDirect" statementType="CALLABLE" parameterMap="callParam">
{call #{dbId} := db_id()}
</update>

public interface SystemMapper {
public class CallParam {
private int dbId;
public int getDbId() {
return dbId;
}
public void setDbId(int dbId) {
this.dbId = dbId;
}
}
void getDbIdDirect(CallParam param);
}

It was interesting that when I changed "update" to "select" java process hanged up...
Let's try to change " { ? = CALL fnc_myFunction } " to "{ CALL #{myPropertie} = fnc_myFunction } ". I think it'll behave much better )

Andrew Shalin

четверг, 22 марта 2012 г. 1:01:23 UTC+4 пользователь Tyrion написал:
I need to invoke a Oracle function that has DML inside and the function dont have parameters.

I tried something like that


    <parameterMap type="com.myCompany.myObject" id="myMap">
        <parameter property="myPropertie" javaType="java.lang.Integer" jdbcType="NUMERIC" mode="OUT"/>
    </parameterMap>

<select id="callFunction"  parameterMap="myMap" statementType="CALLABLE">
    { ? = CALL fnc_myFunction }
</select>



But... I has an error.

### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property '
myPropertie' of 'class org.apache.ibatis.reflection.MetaObject$NullObject' with value '24272' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'myPropertie' in 'class java.lang.Class'
### The error may involve myMapper.
myMap
### The error occurred while setting parameters
### Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property '
myPropertie' of 'class org.apache.ibatis.reflection.MetaObject$NullObject' with value '24272' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'myPropertie' in 'class java.lang.Class'

I'm working with JBOSS and Mybatis 3.0.6, I'm sure MyObject has  "public set
MyPropertie(Integer xxx)"

Thanks in Advance

   
   





Loading...