Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 62080 invoked from network); 25 May 2008 07:30:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 May 2008 07:30:30 -0000 Received: (qmail 16595 invoked by uid 500); 25 May 2008 07:30:26 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 16579 invoked by uid 500); 25 May 2008 07:30:26 -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 16568 invoked by uid 99); 25 May 2008 07:30:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 May 2008 00:30:26 -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; Sun, 25 May 2008 07:29:30 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1K0Afw-0001KO-3k for user-java@ibatis.apache.org; Sun, 25 May 2008 00:29:52 -0700 Message-ID: <17455235.post@talk.nabble.com> Date: Sun, 25 May 2008 00:29:52 -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: 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> <17451630.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Is there a jdbctype 'integer' there ? I thought numeric is what u use instead to represent the same...but anyways I will check ? Secondly its just seems an unnecessory overhead to me to create another class of my own..just for the sake of holding/fetching an integer output value..don't u think... Jeff Butler-2 wrote: > > You might try setting the jdbcType of the OUT parameter to INTEGER. If > that > doesn't work, then you'll need to define an actual class to hold your > results (not just a Map). > > Jeff Butler > > On Sat, May 24, 2008 at 3:35 PM, mfs wrote: > >> >> 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. >> >> > > -- View this message in context: http://www.nabble.com/Calling-a-function-with-Integer-param-and-return-type-an-inline-params-tp17445906p17455235.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.