ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Fagan <mfa...@tde.com>
Subject Re: FW: returning value from stored procedure
Date Wed, 16 Nov 2005 17:02:32 GMT
Kevin,

since your "id" parameter is in/out I would pass in an inital value, 
also I think your JDBC type for that parameter wants to be "NUMERIC" not 
"NUMBER"

Regards,
Mike Fagan


Broderick, Kevin wrote:

> Hi,
>
> Apologies, errors in previous mail.
>
> I'm trying to get the return values from a stored procedure. Working 
> from the standard example below,
>
> Would I be calling the procedure like this:
>
>  
>
> *try*
>
> *{*
>
> *               map.put("**id**", **null**);*
>
> *               map.put("email", "john.smith@gmail.com");*
>
> * *
>
> *sqlMapClient.queryForObject("saveTouch", map);             *
>
> * *
>
> *log.info("**id**: " + (String)map.get("**id**"));*
>
> *log.info("email: " + (String)map.get("email"));*
>
> * *
>
> *} catch (Exception e) {*
>
> *e.printStackTrace();*
>
> *}*
>
> * *
>
> * *
>
> *<parameterMap id="emailParameters" class="java.util.HashMap" >*
>
> *<parameter property="id"       jdbcType="NUMBER" 
>   javaType="java.lang.Integer" **mode="INOUT"**/>*
>
> *<parameter property="email"  jdbcType="VARCHAR" 
> javaType="java.lang.String"  **mode="IN"**/>*
>
> *</parameterMap>*
>
> * *
>
> *<procedure id="saveEmailAddresses" parameterMap="emailParameters" >*
>
> *{call save_email_address (?, ?)}*
>
> *</procedure>*
>
>  
>
> Currently returning this error:
>
> *--- The error occurred in SqlMapEMDB.xml.  ***
>
> *--- The error occurred while applying a parameter map.  ***
>
> *--- Check the touchParameters.  ***
>
> *--- Check the output parameters (retrieval of output parameters 
> failed).  ***
>
> *--- Cause: **_java.lang.NullPointerException_***
>
> *Caused by: **_java.lang.NullPointerException_***
>
> *15:04:47,765 ERROR [STDERR]    at 
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(**_GeneralStatement.java:184_**)***
>
> *15:04:47,765 ERROR [STDERR]    at 
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(**_GeneralStatement.java:100_**)***
>
> * *
>
> Is there any reassignment necessary from the queryForObject method???
>
> I'm using SQL Server and the id parameter in the stored procedure is 
> set to INOUT.
>
>  
>
> Thanks,
>
> Kevin
>
>  
>


Mime
View raw message