You can see from the java docs that each method does infact throw a
SqlException.
http://ibatis.apache.org/docs/java/user/com/ibatis/sqlmap/client/SqlMapExecutor.html

You need to be prepared to catch them if you care to do anything with them.

Nathan

On Mon, May 11, 2009 at 9:26 AM, Bhaarat Sharma <bhaara...@gmail.com> wrote:

> we have been using iBatis for a while now.
> However, we do not perform any error handling while executing the sql maps.
>  Back when we used java code to connect, we used try and catch blocks.
>  Where the catch block would log an error message.
>
> something like this:
>
>             try {
>                 Conn = getConnection(DataCollection.HEREMS);
>                 cstmt = Conn.prepareCall(storProc);
>                 cstmt.setString(1, user.toUpperCase());
>                 rs = cstmt.executeQuery();
>                 while (rs.next()) {
>                     String roleId = rs.getString("role_code");
>                     Roles.add(roleId);
>                 }
>             }catch (SQLException ex) {
>                 log.error(ex.getMessage(),ex);
>             }finally {
>                try {
>                   releaseConnection(Conn, cstmt, null, rs);
>                }catch (SQLException ex) {
>                 log.error(ex.getMessage(),ex);
>                }
>             }
>
> Now with sqlMaps we simply do something like this:
>
>         getSqlMapClientTemplate().queryForList("debtowed.getSingleTenant",
> paramMap);
>
>         if (paramMap.size() == 3)
>         {
>             fmr = (FormerTenants) paramMap.get("single_tenant_results");
>
>  fmr.setTerminationReason(paramMap.get("single_tenant_rejection_results"));
>         }
>
>         return fmr;
>
> In the above code we are expecting 3 resultsets so all we are doing is
> checking if map size is 3.
>
> What if some error happens while executing the stored procedure.  Where
> will that error go?  Is there a way in iBatis to log error messages? I would
> appreciate some sample which would point me in the right direction.
>
> Thanks
>

Reply via email to