ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bhaarat Sharma <bhaara...@gmail.com>
Subject How to do logging in iBatis + Spring
Date Sun, 07 Mar 2010 15:13:04 GMT
We use iBatis + Spring and make use of stored procedures to fetch
information from Oracle DB.  To find out what parameters (HashMap) is sent
to the stored procedure we have to actually set debug points.  We'd like
this information to go to a log. Basically print out name of the Stored Proc
+ all that a HashMap contains (before calling the Stored procedure).

Our setup is as below:

Mapping:
    <procedure id="getReportData" parameterMap="getReportDataCall">
       {call get_rpt (?,?,?,?)}
    </procedure>

      <parameterMap id="getReportDataCall" class="map">
        <parameter property="type" jdbcType="String"
javaType="java.lang.String" mode="IN"/>
        <parameter property="month" jdbcType="Int"
javaType="java.lang.Integer" mode="IN"/>
        <parameter property="Result0" jdbcType="ORACLECURSOR"
javaType="java.sql.ResultSet" mode="OUT" resultMap="result1"/>
        <parameter property="Result1" jdbcType="ORACLECURSOR"
javaType="java.sql.ResultSet" mode="OUT" resultMap="result2"/>
      </parameterMap>

      <resultMap id="select-first-result-hq" class="VO">
        <result property="column1" column="columna"/>
        <result property="column2" column="columnb"/>
      </resultMap

We call our procedures like this:
    HashMap parm = new HashMap ();
    parm.put("type", type_val);
    parm.put("month", month_val);
    getSqlMapClientTemplate().queryForList("mymappingName.getReportData",
parm);


I could make a method that would take SP name + HashMap as parm and then
just put it on the log but then i'd have to explicitly make a call to that
method before I call the Stored procedure.  I will take this as the last
option as it involves me touching all my existing code.

Is there any simpler solution to this?

Mime
View raw message