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: stored proc doesn't return output parameter
Date Wed, 31 Aug 2005 13:06:08 GMT
Try reordering the parameters in your parameter map. The first parameter 
should be the String OUT parameter, the second parameter should be the 
Integer IN parameter.
 Jeff Butler

 On 8/31/05, Deshpande, Bhushan M (IT) <Bhushan.Deshpande@morganstanley.com> 
wrote: 
> 
>  Hi All ,
>  I am using Ibatis 2.1.5 to execute a stored proc on sybase databse which 
> retuns a string result .
> ----------------------
> Entries in contiguration xml file is 
>  
> <parameterMap id="getContactParameters" class="map" >
> 
> <parameter property="contactId" jdbcType="INTEGER" javaType="
> java.lang.Integer" mode="IN"/>
> 
> <parameter property="firstName" jdbcType="VARCHAR" javaType="
> java.lang.String" mode="OUT"/>
> 
> </parameterMap>
> 
> <procedure id="spGetContacts" parameterMap="getContactParameters" >
> 
> {? sp_sample_get_contact (?)} 
> 
> </procedure>
> 
>  also tried 
> 
> {? = call sp_sample_get_contact (?)} but of no avail ;(
> 
> -----------------------------
> 
> Code in the servlet for excution 
> 
> Reader configReader = Resources.getResourceAsReader("SqlMapConfig.xml");
> 
> SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(configReader); 
> 
> sqlMap.startTransaction();
> 
> HashMap paramMap = new HashMap();
> 
> paramMap.put("firstName","");
> 
> paramMap.put("contactId", new Integer(1));
> 
> sqlMap.queryForObject("spGetContacts", paramMap);
> 
> *String firstName = (String) paramMap.get("firstName");*
> 
> sqlMap.commitTransaction();
> 
> -----------------------------------------------
> 
> Variable FirstName *returns "0" instead of expected result .*
> 
> However if the same operation is tried with simple query way it works fine 
> .
> 
> <
> select id="getContact" parameterClass="int" resultClass="contact">select 
> FIRSTNAME as firstName,LASTNAME as lastName, CONTACTID as contactId from 
> CONTACT where CONTACTID = #contactId#</select> 
> 
> Thanks for your all help in advance .
>  ------------------------------
>  
> NOTICE: If received in error, please destroy and notify sender. Sender 
> does not waive confidentiality or privilege, and use is prohibited.
>

Mime
View raw message