ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Just Another Stored Procedure Question
Date Thu, 22 Feb 2007 05:36:56 GMT
You misread Brad's comment, i think.

You have this:
<procedure id="elions.bas.procCounter" parameterClass="hashMap">

You need to have this:
<procedure id="elions.bas.procCounter"
parameterMap="elions.bas.procCounter.param">

..which may still not work because of the "." characters in the name.

Larry


On 2/21/07, Yusuf <Yusuf@ekalife.co.id> wrote:
> Hi, thanks for the feedback...
>
> Brad, Actually I forgot to mention that I have this entry in the sqlmap,
> so I was referring to a class, not a parameterMap:
>
> <typeAlias alias="hashMap" type="java.util.HashMap"/>
>
> Jeff, using parameterMap and # syntax ran successfully, it just won't
> return the value in the v_result OUT parameter..
> I also have tried changing to question marks (?) like this :
>
> <procedure id="elions.bas.procCounter" parameterClass="hashMap">
> {call EKA.SISTEM_KONTROL_SPAJ.GENERATE_COUNTER (?,?,?,?,?,?)}
> </procedure>
>
> but an Invalid Column Type Exception occured...
>
> Actually I found another solution that worked, which is to convert the
> stored procedure to a stored function, and remove the OUT parameter :
>
> FUNCTION generate_counter (
>       v_msco_number    IN       NUMBER,
>       v_lca_id         IN       VARCHAR2,
>       v_prefix         IN       VARCHAR2,
>       v_suffix         IN       VARCHAR2,
>       v_total_length   IN       NUMBER
> ) RETURN VARCHAR2;
>
> and then call it using standard select :
>
> <select parameterClass="hashMap" resultClass="string">
> select EKA.SISTEM_KONTROL_SPAJ.generate_counter(#msco_number:number#,
> #lca_id:varchar#, #prefix:varchar#, #suffix:varchar#, #length:number)
> from dual
> </select>
>
> but I'm still curious how to make this work... are there any other
> suggestions?
>
> thanks & best regards,
> yusuf
>
> -----Original Message-----
> From: Jeff Butler [mailto:jeffgbutler@gmail.com]
> Sent: Wednesday, February 21, 2007 7:56 PM
> To: user-java@ibatis.apache.org
> Subject: Re: Just Another Stored Procedure Question
>
>
> Yes, also...
>
> - If you use a parameterMap, then use question marks as parameter
> markers
> - Else use parameterClass and the # syntax
>
> You can't use both.
>
> Jeff Butler
>
>
> On 2/21/07, Brad Handy < brad.handy@gmail.com
> <mailto:brad.handy@gmail.com> > wrote:
>
> It seems to me this configuration is the problem:
>
> <procedure id="elions.bas.procCounter " parameterClass="hashMap">
>        {
>         call EKA.SISTEM_KONTROL_SPAJ.GENERATE_COUNTER (
>                  #hasil:varchar#,#msco_number:number#, #lca_id:varchar#,
> #prefix:varchar#,
>
>                  #suffix:varchar#, #length:number#)
>        }
> </procedure>
>
> You're using the "parameterClass " attribute and trying to reference a
> "parameterMap".  Change the name of the attribute in your <procedure>
> tag.
>
>
> I'm still just a noob, but that seems like it could be a problem, if not
> the problem.
>
>
>
> Brad
>
>
>
>
> On 2/21/07, Yusuf < Yusuf@ekalife.co.id <mailto:Yusuf@ekalife.co.id> >
> wrote:
>
> Hi,
> Really2 sorry for asking, i know this has been asked before many times,
> i have browsed through the docs, the faqs page, and the mailing lists,
> but i can't seem to make this work (oracle):
>
> oracle procedure :
>
> PROCEDURE generate_counter (
>         v_result         OUT      VARCHAR2,
>       v_msco_number    IN       NUMBER,
>       v_lca_id         IN       VARCHAR2,
>       v_prefix         IN       VARCHAR2,
>       v_suffix         IN       VARCHAR2,
>       v_total_length   IN       NUMBER
> );
>
> in sqlmap :
>
> <parameterMap id="elions.bas.procCounter.param" class="hashMap">
>         <parameter property="hasil" jdbcType="varchar" javaType="string"
>
> mode="OUT"/>
>         <parameter property="msco_number" jdbcType="number"
> javaType="int" mode="IN"/>
>         <parameter property="lca_id" jdbcType="varchar"
> javaType="string" mode="IN"/>
>         <parameter property="prefix" jdbcType="varchar"
> javaType="string" mode="IN"/>
>         <parameter property="suffix" jdbcType="varchar"
> javaType="string" mode="IN"/>
>         <parameter property="length" jdbcType="number" javaType="int"
> mode="IN"/>
> </parameterMap>
>
> <procedure id="elions.bas.procCounter" parameterClass="hashMap">
> {call EKA.SISTEM_KONTROL_SPAJ.GENERATE_COUNTER (#hasil:varchar#,
> #msco_number:number#, #lca_id:varchar#, #prefix:varchar#,
> #suffix:varchar#, #length:number#)}
> </procedure>
>
> in spring dao :
>
> public String selectCounter(int msco_number, String lca_id, String
> prefix, String suffix, int total_length) {
>         Map map = new HashMap();
>         String hasil = "";
>         map.put("hasil", hasil);
>         map.put("msco_number", msco_number);
>         map.put("lca_id", lca_id);
>         map.put("prefix", prefix);
>         map.put("suffix", suffix);
>         map.put("length", total_length);
>         String result = (String)
> getSqlMapClientTemplate().queryForObject(" elions.bas.procCounter", map
> );
>         System.out.println("RESULT = " + result);
>         System.out.println("HASIL = " + hasil);
>         return hasil;
>         }
>
> both the String result and hasil contains nothing... can someone help
> me? thanks
>
>
>
>
>
>
>

Mime
View raw message