Excellent, glad you got it worked out.
Larry
On 12/20/06, Tegan Clark <[EMAIL PROTECTED]> wrote:
Ahh, Open Source is a beautiful thing. The problem is completely with me
(as per usual).
My problem is that Oracle requires a name to be given to user defined data
types.
From Oracle:
"In these signatures, index represents the parameter index, sqlType is the
typecode for the SQL datatype, and sql_name is the name given to the
datatype (for user-defined types, when sqlType is a STRUCT, REF, or ARRAY
typecode). If you enter an invalid sqlType, a Parameter Type Conflict
exception is thrown."
I debugged my way through the the iBATIS SqlExecuter and found that there is
code in there to set the name if the parameter is supplied in the typeName
attribute. So the correct mapping should read:
<parameterMap id="listErrorByClientSummaryParameters"
class="java.util.Map">
<parameter property="report.dateRange"
javaType="com.sc.domain.report.DateRange" jdbcType="STRUCT"
typeName="DATERANGETYPE" mode="INOUT"/>
I read on some post somewhere Clinton saying "we've pretty much mapped the
entire jdbc api", and I reckon he's right.
Thanks Larry for the pointer.
Tegan
----- Original Message ----
From: Larry Meadors <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, December 20, 2006 12:45:16 PM
Subject: Re: mode="INOUT" with custom type handler
Hmm, jdbcType="DATERANGETYPE" should not work at all. I am surprised
it doesn't blow up...it probably should. ;-)
You may want to try jdbcType="OTHER" or "STRUCT" instead - it should
be something from java.sql.Types.
Larry
On 12/20/06, Tegan Clark <[EMAIL PROTECTED]> wrote:
>
>
> Hi Group,
>
>
> I've successfully implemented a custom type handler to handle an Oracle
> custom type. All works just fine as long as my custom type is registered
as
> mode="IN". In Oracle it's actually an INOUT. As soon as i change the
mode
> to INOUT in my map I get a "Invalid column type" from iBATIS when it types
> to map the parameters. My type handler never gets called, so the problems
> not in there (I think).
>
> Here's the snippet of the map:
>
> <parameterMap id="listErrorByClientSummaryParameters"
> class="java.util.Map">
> <parameter property="report.dateRange"
> javaType="com.sc.domain.report.DateRange" jdbcType="DATERANGETYPE"
> mode="INOUT"/>
>
> And the registration in the config:
>
> <typeHandler javaType="com.sc.domain.report.DateRange"
> jdbcType="DATERANGETYPE"
>
callback="com.sc.dal.reportBuilder.ibatis.typeHandler.DateRangeTypeHandler"
> />
>
> Changing to INOUT throws me:
>
> The error occurred in
>
com/sc/dal/reportBuilder/ibatis/errorLogSummaryReport-map.xml.
>
> The error occurred while executing query procedure.
> Check the {call
all_error_pkg.listErrorByClientSummary()}.
>
> Check the output parameters (register output parameters failed).
> Cause: java.sql.SQLException: Invalid column type; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
> The error occurred in
>
com/aptare/sc/dal/reportBuilder/ibatis/errorLogSummaryReport-map.xml.
>
> The error occurred while executing query procedure.
> Check the {call
all_error_pkg.listErrorByClientSummary()}.
>
> Check the output parameters (register output parameters failed).
> Cause: java.sql.SQLException: Invalid column type
>
> I read Oracle can throw this if you set a null on a column that doesn't
have
> a type set, but I'm pretty sure I'm not in that boat.
>
> Anyone on the list had any similar experiences?
>
> All help greatly appreciated.
>
> Tegan
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com