user165851
user165851

Reputation:

Ibatis out params from stored procedure in Oracle 11g

I have a stored procedure which has three out params all user defined types. I use ibatis as ORM from java code to call the stored procedure. How do i configure this stored procedure call in ibatis xml and how do I get the results back in my java code. procedure test( p_a in int default 0 , p_b in number default 0,
p_criteria out TBL_A, p_baseline out TBL_B, p_results out TBL_C);

Any help would be highly appreciated. thanks, gagan suri

Upvotes: 0

Views: 1143

Answers (1)

arghtype
arghtype

Reputation: 4534

In your xml configuration provide parameters with in/out mode (jdbcType is optional):

<procedure id="callProcedure1" parameterClass="map">
        {
            call procedure1(
                #value1,jdbcType=DECIMAL,mode=INOUT#,
                #value2,jdbcType=DECIMAL,mode=INOUT#,
                #value3,jdbcType=DECIMAL,mode=INOUT#,
                )
        }
</procedure>

And in your dao class just get your results from parameters:

final Map<String, Object> params = new HashMap<String, Object>();
//provide input parameters here
params.put("value1", 1);
AbstractSQLMapDao.queryForObject("namespace.callProcedure1", params);
//retrieve you output
Double value1 = params.get("value1")

Upvotes: 1

Related Questions