ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Zabel" <...@ezabel.com>
Subject Re: Really Weird Oracle REF Cursor Behavior
Date Fri, 22 Aug 2008 19:35:31 GMT
I finally got back to look at this, and discovered the problem.

One of the <parameter>s in the <parameterMap> was defined in the xml
as the incorrect JDBC and Java type.

It was:
<parameter property="invoiceNbr" javaType="Integer" jdbcType="NM" mode="IN"/>

When it should have been:
<parameter property="invoiceNbr" javaType="String" jdbcType="VARCHAR"
mode="IN"/>

Since the stored proc was actually doing some char operations on that
input parameter, this seemed to have been screwing up the result set
depending on the data. So the REF CURSOR was returning zero rows
because the input data was somehow messed up based on the type
information being sent from the iBATIS query. When I tested with JDBC,
I was correctly calling stmt.setString() for that variable.

Lesson learned: Always make sure you're defining the correct types for
your parameters.

I feel better now!

Thanks,
Ian.

On Tue, Aug 12, 2008 at 5:41 PM, Ian Zabel <ian@ezabel.com> wrote:
> Hello,
>
> Using the latest build of iBATIS and Oracle REF Cursors, we're running
> into a problem with certain rows not coming back in the ResultSet. It
> seems to be certain data in the rows that makes them not return.
>
> For example, we have a column called INTERNAL_INVOICE_NBR. With the
> following values in that column, ROW 1 does _not_ return in the
> ResultSet from the REF Cursor when using iBATIS.
> ROW 1: mts - Sample Invoice, b2325
> ROW 2: mts - New Invoice, b2330
>
> However, if we update the column in ROW 1 with the value from ROW 2,
> then the row returns fine.
>
> Also, when using straight JDBC, the rows are returned.
>
> I've tried disabling cacheModels, enhancement, and lazyLoading, to no
> avail. When debugging into the iBATIS
> SqlExecutor.retrieveOutputParameters method, the ResultSet that it
> gets on line 399 does not include the row. In fact, if this row is the
> only row returned by the query, the ResultSet has no results at all.
>
> Any ideas? I'm really confused because it works fine with JDBC using
> the same connection as iBATIS, and if we change the data somewhat,
> then it returns fine.
>
> Thanks,
> Ian.
>

Mime
View raw message