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 function: NUMBER result, NUMBER IN parameter
Date Mon, 20 Nov 2006 16:24:45 GMT
NUMBER is not a valid JDBC Type (it is Oracle specific).  See here for the
valid options:

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Types.html


Jeff Butler


On 11/20/06, c.zecca@ads.it <c.zecca@ads.it> wrote:
>
>  The TIPO_DATO_RIGA package declares the following overloaded versions of
> the exists_id() method in its interface
>
>    function exists_id
>   ( p_tipo_riga_ID  in number(10)
>   ) return number;
>   pragma restrict_references( exists_id, WNDS );
>
>    function exists_id
>   ( p_tipo_dato_ID  in number(10)
>   , p_nome          in varchar2(30)
>   ) return number;
>   pragma restrict_references( exists_id, WNDS );
>
>
> Here is the SQL map
>
> <procedure id="*esisteTipoRiga*" parameterClass="java.util.Map">
>  {#*result*,mode=OUT,javaType=java.lang.Integer,jdbcType=NUMBER# = call
> tipo_dato_riga.exists_id( #*pId*,javaType=java.lang.Integer,jdbcType=NUMBER,mode=IN#
> ) }
> </procedure>
>
> and the Java code that calls it
>
> SqlMapClient lSqlMapClient = Configurazione.getSqlMapIstanza();
>
>     Integer lInteger;
>     HashMap< String, Integer > lHashMap = new HashMap< String, Integer
> >();
>     lHashMap.put( "pId", new Integer( 1234 ) );
>
>         try
>         {
>         lSqlMapClient.update( "esisteTipoRiga", lHashMap );
>         }
>         catch (SQLException pException)
>         {
>         pException.printStackTrace();
>         throw pException;
>         }
>     lInteger = lHashMap.get( "result" );
>        boolean lResult = lInteger.intValue() == 1;
>
> causes the following diagnostic
>
> --- The error occurred in it/finmatica/gpj/aa/frontebd/TipoRiga.xml.
> --- The error occurred while executing update procedure.
> --- Check the {*? = call tipo_dato_riga.exists_id( ? )* }.
> --- Check the output parameters (register output parameters failed).
> --- Cause: *java.sql.SQLException*: Invalid column type
> Caused by: *java.sql.SQLException*: Invalid column type
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(
> *GeneralStatement.java:91*)
> at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(*
> SqlMapExecutorDelegate.java:500*)
> at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(*
> SqlMapSessionImpl.java:85*)
>
> Please note that the following PL/SQL
>
> declare
> lId number;
> lResult number;
> begin
> lId := 1234;
> lResult := tipo_dato_riga.exists_id( lId );
> dbms_output.put_line( 'here we are...' );
> dbms_output.put_line( 'lId = ' || lId || ', lResult = ' || lResult );
> end;
>
> works fine.
> What's wrong in the SQL map / java code?
> Any hint?
> Is there any simpler approach on the Java side?
>
> Thanks in advance
>

Mime
View raw message