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: Stored procedures (package functions) returning a row
Date Fri, 06 Oct 2006 15:23:15 GMT
I am not understanding why you are returning a database type instead
of just a number.

Why not just return a number?

Larry



On 10/6/06, C.Zecca@ads.it <C.Zecca@ads.it> wrote:
>
>
> Hi, Larry
>
>  If I use a return parameter
>
>  <parameterMap id="paraMap" class="">
>  <parameter property="a_given_key" jdbcType="INTEGER"
> javaType="java.lang.Integer" mode="OUT"/>
>  </parameterMap>
>
>  <procedure id="get_key_2" parameterMap="paraMap">
>  { ? = call ut_Foo.get_key_2 }
>  </procedure>
>
>  and retrieve it on the Java side
>
>         lSqlMapClient.update( "get_key_2", lHashMap );
>
>  the PreparedStatement seems to be good
>
>  DEBUG [main] - {pstm-100001} PreparedStatement: { ? = call ut_Foo.get_key_2
> }
>
>  But a while after you got an exception
>
> com.ibatis.common.jdbc.exception.NestedSQLException:
>  --- The error occurred in
> it/finmatica/gpj/aa/frontebd/FooTest.xml.
>  --- The error occurred while applying a parameter map.
>  --- Check the GPJ.paraMap.
>  --- Check the statement (update procedure failed).
>  --- Cause: java.sql.SQLException: ORA-06550: line 1, column 20:
>  PLS-00382: expression is of wrong type
>  ORA-06550: line 1, column 7:
>  PL/SQL: Statement ignored
>
>  [...]
>  at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:500)
>  Probably iBatis tries to generate code to access a number, instead the
> returned data is a
>
>  type t_PK is record
>  ( tipo_dato_ID number(10)
>  );
>
>  At this point, I should in some specify that I want to get a t_PK record
> type not a jdbcType="INTEGER".
>
>  <parameterMap id="paraMap" class="">
>  <parameter property="a_given_key" jdbcType="something here for the t_PK
> record type" .../>
>  </parameterMap>
>
>  But how could I do it?
>  Is my reasoning correct?
>  Otherwise, please, let you write the right parameterMap specification that
> solves the question.
>
>  ciao
>
>  larry.meadors@gmail.com scritti il 06/10/2006 16:34:25
>
>
>  > No, I meant just using multiple parameters, one for each field.
>  >
>  > Crude, but effective.
>  >
>  > Larry
>  >
>  >
>  > On 10/6/06, C.Zecca@ads.it <C.Zecca@ads.it> wrote:
>  > >
>  > >
>  > > larry.meadors@gmail.com scritti il 06/10/2006 16:01:09
>  > >
>  > >  > Sorry, I haven't been following this thread that closely, but why
> not
>  > >  > use out parameters?
>  > >  >
>  > >  > Larry
>  > >
>  > >  Do you mean that it's possible to use the typeName attribute of the
>  > > parameterMap statement?
>  > >
>  > >  <parameterMap id="parameterMapName" [class="com.domain.Product"]>
>  > >  <parameter property ="propertyName" [jdbcType="VARCHAR"]
>  > >  [javaType="string"]
>  > >  [nullValue="-9999"]
>  > >  [typeName="{REF or user-defined type}"]
>  > >  [resultMap=someResultMap]
>  > >  [mode=IN|OUT|INOUT]
>  > >  [typeHandler=someTypeHandler]
>  > >  [numericScale=2]/>
>  > >  <parameter …… />
>  > >  <parameter …… />
>  > >  </parameterMap>
>  > >
>  > >  Jeff wrote that iBatis is a quite thin layer over JDBC.
>  > >  Well, but if the Oracle JDBC driver does NOT support structured types
> (such
>  > > as record), how could iBatis?
>  > >  I haven't explored anymore the issue, maybe I'm wrong
>  > >
>  > >  ciao
>  > >  Cesare
>
>
>

Mime
View raw message