ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Weird IN OUT Param problem.
Date Thu, 31 Jan 2008 18:57:44 GMT
yeah for future reference all of the types can be found here
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Types.html

On Jan 30, 2008 3:01 PM, Sundar Sankaranarayanan <
Sundar.Sankaranarayanan@phoenix.edu> wrote:

>  Perfect. That was it!!! I changed it to float and it worked. Thanks a lot
> for your help Jeff. I truly appreciate your fast response too..
>
>
> Sundar
>
>  ------------------------------
> *From:* Jeff Butler [mailto:jeffgbutler@gmail.com]
> *Sent:* Wednesday, January 30, 2008 2:55 PM
>
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: Weird IN OUT Param problem.
>
>  NUMBER is not a valid jdbcType - that's at least one problem.  Obviously,
> this is not so critical on the IN parameters, but it causes problems for the
> OUT/INOUT parameters.  A java.lang.Long would typically correspond to
> jdbcType BIGINT.
>
> See java.sql.Types for valid jdbcTypes.
>
> You're also asking for an automatic down cast.  This may or may not work,
> depending on the database.
>
> Jeff Butler
>
>
>
> On Jan 30, 2008 3:44 PM, Sundar Sankaranarayanan <
> Sundar.Sankaranarayanan@phoenix.edu> wrote:
>
> >  Thanks for the immediate response Jeff.
> >
> > My sql-map is something like this.
> >
> >
> > <
> > sqlMap>
> >
> > <parameterMap id="exampleParam" class="map">
> >
> > <parameter property="p_irn" jdbcType="NUMBER" javaType="java.lang.Long"
> > mode="IN" />
> >
> > <parameter property="p_orga_number" jdbcType="NUMBER" javaType="
> > java.lang.Long" mode="IN" />
> >
> > <parameter property="p_csph" jdbcType="NUMBER" javaType="java.lang.Long"
> > mode="IN" />
> >
> > <parameter property="p_grade" jdbcType="VARCHAR" javaType="
> > java.lang.String" mode="IN" />
> >
> > <parameter property="p_activity_id" jdbcType="VARCHAR" javaType="
> > java.lang.String" mode="IN" />
> >
> > <parameter property="p_activity_title" jdbcType="VARCHAR" javaType="
> > java.lang.String" mode="IN" />
> >
> > <parameter property="p_term_date" jdbcType="DATE" javaType="
> > java.sql.Date" mode="IN" />
> >
> > <parameter property="p_cred_att" jdbcType="NUMBER" javaType="
> > java.lang.Double" mode="IN" />
> >
> > <parameter property="p_reuse_code" jdbcType="VARCHAR" javaType="
> > java.lang.String" mode="IN" />
> >
> > <parameter property="p_tran_act_oid" jdbcType="NUMBER" javaType="
> > java.lang.Long" mode="INOUT"/>
> >
> > <parameter property="p_clas_rost_#" jdbcType="NUMBER" javaType="
> > java.lang.Long" mode="INOUT"/>
> >
> > </parameterMap>
> >
> > <procedure id="example"
> >
> > parameterMap="exampleParam">
> >
> > {call example(?,?,?,?,?,?,?,?,?,?,?)}
> >
> > </procedure>
> >
> > </sqlMap>
> >
> >
> > The last 2 params are float in the Database. I am not sure if this has
> > something to do with the procedure returning multiple out params.
> >
> >  ------------------------------
> > *From:* Jeff Butler [mailto:jeffgbutler@gmail.com]
> > *Sent:* Wednesday, January 30, 2008 2:39 PM
> > *To:* user-java@ibatis.apache.org
> > *Subject:* Re: Weird IN OUT Param problem.
> >
> >   Make sure you are specifying the jdbcType of the out/inout parameters
> > in your parameter map.
> >
> > Jeff Butler
> >
> > On Jan 30, 2008 3:37 PM, Sundar Sankaranarayanan <
> > Sundar.Sankaranarayanan@phoenix.edu> wrote:
> >
> > >  Hi All,
> > > I have a stored procedure,  which is something like this.
> > >
> > > call example(?,?,?,?,?,?)
> > >
> > > The first four params are IN params and the last 2 are out params. If
> > > I set the mode="OUT" or set the mode as "INOUT" in the sql-map xml file I
> > > get a
> > >
> > >
> > >
> > >                 --- Cause: *java.sql.SQLException*
> > > : Invalid column type; nested exception is *
> > > com.ibatis.common.jdbc.exception.NestedSQLException*:
> > >
> > >                 --- The error occurred in ibatis/config/procedures/
> > > example.xml.
> > >
> > >                 --- The error occurred while executing query
> > > procedure.
> > >
> > >                 --- Check the {call example(?,?,?,?,?,?)}
> > >
> > >                 --- Check the output parameters (register output
> > > parameters failed).
> > >
> > > *                --- Cause: **java.sql.SQLException**: Invalid column
> > > type*
> > >
> > >                 at
> > > org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate
> > > (*SQLStateSQLExceptionTranslator.java:121*)
> > >
> > >                 at
> > > org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate
> > > (*SQLErrorCodeSQLExceptionTranslator.java:322*)
> > >
> > >                 at
> > > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(*
> > > SqlMapClientTemplate.java:197*)
> > >
> > >                 at
> > > org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult
> > > (*SqlMapClientTemplate.java:220*)
> > >
> > >                 at
> > > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(*
> > > SqlMapClientTemplate.java:267*)
> > >
> > >                 at
> > > com.apollo.sisaw.entry.dao.implementation.IbatisTranscriptActivityDaoImpl.insertTranscriptActivity
> > > (*IbatisTranscriptActivityDaoImpl.java:408*)
> > >
> > >                 at
> > > com.apollo.sisaw.entry.dao.implementation.IbatisTranscriptActivityDaoImplTest.testInsertTranscriptActivity
> > > (*IbatisTranscriptActivityDaoImplTest.java:197*)
> > >
> > >                 at sun.reflect.NativeMethodAccessorImpl.invoke0(*Native
> > > Method*)
> > > .
> > > The procedure does run fine if I change the mode to "IN" but the
> > > values that I expect to be set into the input map I provide is being set as
> > > null. I dont know what has to be done. I am using Spring with Ibatis
> > > together and have an oracle database. Any help on this is appreciated.
> > >
> > >
> > > Thanks and Regards
> > > Sundar .
> > >
> >
> >
>

Mime
View raw message