ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan CaƱadas <jcgb...@tid.es>
Subject fetch out of sequence
Date Fri, 02 Dec 2005 13:41:39 GMT
Hi

I'm trying to get a list of values from an oracle stored procedure....

I've been updated ibates to support oracle's cursor 
(http://opensource2.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions)


but when i run the program it raises the error:
--------------------
Caused by: java.sql.SQLException: ORA-01002: fetch out of sequence

   at 
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)


--------------------

Oracle code:

CREATE OR REPLACE Package TypesPackage AS
     TYPE ref_cursor IS REF CURSOR;
  END TypesPackage;
/

CREATE OR REPLACE PACKAGE BODY SYSPackage is
   PROCEDURE getUsuariosCursor (usuariosCursor OUT 
TypesPackage.ref_cursor) AS          BEGIN
       OPEN usuariosCursor FOR
           SELECT userid, login, tipousr, descr, email FROM usuario 
ORDER BY login;
   END getUsuariosCursor;
END;
/

--------------------
usuario.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="Usuario">
<typeAlias alias="usuario" type="es.miEmpresa.miProyecto.modelo.Usuario" />

<resultMap id="getUsuarioRef" class="usuario">
   <result property="id" column="userid" />
   <result property="login" column="login" />
   <result property="tipo" column="tipousr" />
   <result property="descripcion" column="descr" />
   <result property="email" column="email" />
</resultMap>

<parameterMap id="getUsuariosRefPM" class="map">
   <parameter property="usuariosCursor" jdbcType="ORACLECURSOR" 
mode="OUT" resultMap="getUsuarioRef" />
</parameterMap>

<procedure id="getUsuariosRef" parameterMap="getUsuariosRefPM">
   { call SYSPackage.getUsuariosCursor(?) }
</procedure>

</sqlMap>
--------------------
and the java source:

       Map map = new HashMap();
       //List list;
       try {
           Prueba.sqlMap.queryForObject("getUsuariosRef", map);
           System.out.println(map.get("usuariosCursor"));
       }catch(Exception e){
           e.printStackTrace();
       }

Can anyone help me? what is wrong? how can i solve this problem? i'm 
newbie in java and ibates...

Thanks

Mime
View raw message