Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 56709 invoked from network); 24 May 2008 20:35:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 May 2008 20:35:56 -0000 Received: (qmail 74892 invoked by uid 500); 24 May 2008 20:35:51 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 74877 invoked by uid 500); 24 May 2008 20:35:51 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 74866 invoked by uid 99); 24 May 2008 20:35:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 May 2008 13:35:51 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 May 2008 20:34:56 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1K00ST-0000kd-RO for user-java@ibatis.apache.org; Sat, 24 May 2008 13:35:17 -0700 Message-ID: <17451630.post@talk.nabble.com> Date: Sat, 24 May 2008 13:35:17 -0700 (PDT) From: mfs To: user-java@ibatis.apache.org Subject: Re: Calling a function with Integer param and return type an inline params In-Reply-To: <17451062.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: farhan.sarwar@gmail.com References: <17445906.post@talk.nabble.com> <17451062.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Jeff with ur input i did get this to work, as below but please suggest if there is to be a better way to do this, also i am not getting the result of the type i am expecting (i.e. it should be Integer instead of BigDecimal which i believe the JDBC api is returning and certainly something i would want avoid typecasting after conversion)...so i want suggestion as whats the better way of doing this, now let me add that since my requirement is so minimal (function call with integer param and integer return type) i didnt knew what better way to achieve it..like defining my own resultMap of class "map" with one property i.e. stateId of type Integer? or ?? please suggest...preferably with an example Mapping File ========== { #result,mode=OUT,javaType=java.lang.Integer,jdbcType=NUMERIC# = call location.get_state(#stateId,javaType=java.lang.Integer,jdbcType=NUMERIC,mode=IN#) } DAO code - uses SqlMapDaoTemplate ======== Map parms = new HashMap(); parms.put("p_location_id", new Integer(1)); queryForObject("getStateIdByLocation", parms); BigDecimal stateId = (BigDecimal) parms.get("result"); <-- Expecting Integer here Thanks in advance.. mfs wrote: > > still doesnt work.. and as per the javadoc the SqlMapDaoTemplate.update() > javadoc "Executes a mapped SQL UPDATE statement", i dont think it will > work here, just guessing.. > > > Jeff Butler-2 wrote: >> >> There's no result set here, so queryForObject won't work. Try this in >> your >> DAO: >> >> Map parms = new HashMap(); >> parms.put("stateId", new Integer(1)); >> update("getState", parms); >> Integer stateId = (Integer) parms.get("result"); >> >> Jeff Butler >> >> >> >> On Sat, May 24, 2008 at 4:01 AM, mfs wrote: >> >>> >>> Guys, >>> >>> I am trying to call an oracle function (using inline parameters) and it >>> just >>> doesnt seem to work and returns null (though the same has been tested >>> from >>> a >>> standalone plsql client returns the result as expected).. >>> >>> Can anyone suggest as to what the problem is in the code below, the >>> oracle >>> function takes a number argument and returns a number, >>> >>> DAO class >>> ----- >>> Integer stateId = (Integer)queryForObject("getState", new Integer(1)); >>> System.out.println(stateId); >>> >>> mapping.xml >>> ------ >>> >>> { #result,javaType=java.lang.Integer,jdbcType=NUMERIC# = call >>> >>> location.get_state(#stateId,javaType=java.lang.Integer,jdbcType=NUMERIC,mode=IN#) >>> } >>> >>> >>> Thanks in advance >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Calling-a-function-with-Integer-param-and-return-type-an-inline-params-tp17445906p17445906.html >>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com. >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Calling-a-function-with-Integer-param-and-return-type-an-inline-params-tp17445906p17451630.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.