ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From C.Ze...@ads.it
Subject Stored procedures (package functions) returning a row
Date Mon, 02 Oct 2006 12:09:38 GMT



The function

function get_key_2
return Tipo_Dato.t_PK;

of the ut_Tipo_Dato package returns a row (specifically a row composed by a
single value).

A very simple JavaBean class has been created ChiaveBean and the XML has
been written as follows

      <resultMap id="mapChiave"
class="it.finmatica.gpj.aa.frontebd.ChiaveBean">
            <result property="id" column="TIPO_DATO_ID"/>
      </resultMap>

      <procedure id="get_key_2" resultMap="mapChiave">
            {call ut_Tipo_Dato.get_key_2}
      </procedure>

The Java code calls the queryForObject() to get a newly allocated
ChiaveBean object, the Java homologous for
the Tipo_Dato.t_PK record type, accordingly to
http://opensource.atlassian.com/confluence/oss/pages/diffpages.action?pageId=39&originalId=5835

            ChiaveBean lChiaveBean = (ChiaveBean)
lSqlMapClient.queryForObject( "get_key_2", null );

Analysing the exception stack it would seem that calling queryForObject()
wrongly instructs the DB to call a package procedure  instead of correctly
call a package  function
(http://pls-00221.ora-code.com/)

com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
it/finmatica/gpj/aa/frontebd/DizionarioTipiDatoTest.xml.
--- The error occurred while applying a parameter map.
--- Check the get_key_2-InlineParameterMap.
--- Check the statement (update procedure failed).
--- Cause: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

      at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(
GeneralStatement.java:185)
      at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(
GeneralStatement.java:104)
      at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(
SqlMapExecutorDelegate.java:561)



1)
Is the interpretation of the diagnostic corerct?

2)
If so, what is wrong?

3)
How should be written both the XML config file and the Java code to run a
package function that returns a row? Is there a better way to call
get_key_2() ?

Thanks in advance for any help

ciao
Cesare
Mime
View raw message