ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: iBATIS: NullPointerException when returning value from a stored procedure in MSSQL
Date Sat, 23 Feb 2008 20:04:58 GMT
Should be jdbcType="INTEGER"

See here:

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Types.html

Jeff Butler

On Fri, Feb 22, 2008 at 3:31 PM, Ahmed, Arshad <aahmed@cavtel.com> wrote:

> I modified the parameter map to include the output parameter and also
> used the update call. The following is my parameter map now:
>
>  <parameterMap id="paramVendorOrder" class="vendor_order_class">
>    <parameter property="workQueueIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="orderItemIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="vendorIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="vendorOrderTypeIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="vendorStatusIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="vendorTicket" jdbcType="VARCHAR"
> javaType="java.lang.String" mode="IN" />
>    <parameter property="createdBy" jdbcType="VARCHAR"
> javaType="java.lang.String" mode="IN" />
>    <parameter property="contactName" jdbcType="VARCHAR"
> javaType="java.lang.String" nullValue="" mode="IN" />
>    <parameter property="contactPhone" jdbcType="VARCHAR"
> javaType="java.lang.String" nullValue="" mode="IN" />
>    <parameter property="updatedBy" jdbcType="VARCHAR"
> javaType="java.lang.String" mode="IN" />
>    <parameter property="actionCode" jdbcType="VARCHAR"
> javaType="java.lang.String" mode="IN" />
>    <parameter property="incidentIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="vendorMeet" jdbcType="VARCHAR"
> javaType="java.lang.String" mode="IN" />
>    <parameter property="callingSystemIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="DBSystemIDAsLong" jdbcType="INT"
> javaType="java.lang.Long" mode="IN" />
>    <parameter property="commitTime" jdbcType="DATETIME"
> javaType="java.util.Date" mode="IN" />
>    <parameter property="vendorOrderID" jdbcType="INT"
> javaType="java.lang.Long" mode="OUT" />
>  </parameterMap>
>
>
> <procedure id="sp_insert_ebonding_vendororder_b"
> resultClass="java.lang.Long" parameterMap="paramVendorOrder">
>    { ?= call
> sp_insert_ebonding_vendororder_b(?,?,?,?,?,?,?,?,?,null,null,?,null,null
> ,?,?,?,?,?,?) }
>  </procedure>
>
> I get the following exception now. I'm using Microsoft jdbc driver...
>
> --- Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]The specified SQL type is not supported by this driver.
> Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]The specified SQL type is not supported by this driver.
>        at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> WithCallback(GeneralStatement.java:185)
>         at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> ForObject(GeneralStatement.java:104)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlM
> apExecutorDelegate.java:561)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlM
> apExecutorDelegate.java:536)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSes
> sionImpl.java:93)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClie
> ntImpl.java:70)
>        at
> com.talk.provisioning.ebtacomservice.server.persistence.ibatis.VendorOrd
> erDAO.insert(VendorOrderDAO.java:91)
>        at
> com.talk.provisioning.ebtacomservice.server.EBondingHelper.insertVendorO
> rder(EBondingHelper.java:451)
>        at
> com.talk.provisioning.ebtacomservice.server.EBondingHelper.persistCreate
> TicketPreBinding(EBondingHelper.java:703)
>        at
> com.talk.provisioning.ebtacomservice.server.EBondingWebService.CreateTic
> ket(EBondingWebService.java:158)
>        at
> com.talk.provisioning.ebtacomservice.server.Test.main(Test.java:15)
> Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
> JDBC]The specified SQL type is not supported by this driver.
>        at
> com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
>        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
> Source)
>        at
> com.microsoft.jdbc.sqlserver.tds.TDSRPCParameter.initializeUserParam(Unk
> nown Source)
>        at
> com.microsoft.jdbc.sqlserver.SQLServerImplStatement.addUserParametersToR
> PC(Unknown Source)
>        at
> com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown
> Source)
>        at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown
> Source)
>        at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown
> Source)
>        at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown
> Source)
>        at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(Sql
> Executor.java:289)
>        at
> com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecute
> Query(ProcedureStatement.java:34)
>        at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> WithCallback(GeneralStatement.java:173)
>        ... 10 more
>
> -----Original Message-----
> From: Larry Meadors [mailto:larry.meadors@gmail.com]
> Sent: Friday, February 22, 2008 12:03 PM
> To: Ahmed, Arshad
> Cc: user-java@ibatis.apache.org
> Subject: Re: iBATIS: NullPointerException when returning value from a
> stored procedure in MSSQL
>
>  That all looks good, but you need to define an OUT parameter to get
> the value back.
>
> You may also want to call this as an update or insert (to make sure
> that the transaction is committed).
>
> Larry
>

Mime
View raw message