ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deshpande, Bhushan M \(IT\)" <Bhushan.Deshpa...@morganstanley.com>
Subject stored proc doesn't return output parameter
Date Wed, 31 Aug 2005 12:26:34 GMT
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