ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Munat <b...@munat.com>
Subject Re: fetch out of sequence
Date Mon, 05 Dec 2005 16:33:00 GMT
I'm not sure about the output parameter stuff, but the "there is no result map named..." I

just saw recently... Make sure your resultMap element comes *before* the select element 
that uses it in your sqlMap file... hope that helps.

b

Juan Cañadas wrote:
> ok, thanks...
> 
> i have been replaced older ibatis jars.... now, i get this error...
> 
> com.ibatis.common.jdbc.exception.NestedSQLException:  --- The error 
> occurred in es/xx/dao/rdb/usuario.xml. --- The error occurred while 
> applying a parameter map. --- Check the Usuario.getUsuariosRefPM. --- 
> Check the output parameters (retrieval of output parameters failed). --- 
> Cause: com.ibatis.sqlmap.client.SqlMapException: There is no result map 
> named getUsuarioRef in this SqlMap.
> Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no result 
> map named getUsuarioRef in this SqlMap.
>    at 
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)

> 
>    at 
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)

> 
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)

> 
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)

> 
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:93)

> 
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:70)

> 
>    at es.tid.imagenio.eai.Prueba.main(Prueba.java:100)
> 
> someone can help me?
> 
> thanks....
> 
> Mike Fagan wrote:
> 
>> Juan,
>>
>> The source code has been updated to fix this error. You can download 
>> patch code at:
>> http://opensource2.atlassian.com/confluence/oss/pages/viewpageattachments.action?pageId=561

>>
>>
>> Regards,
>> Mike Fagan
>>
>> Juan Cañadas wrote:
>>
>>> 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