ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Barbridge <sean.barbri...@gmail.com>
Subject Recursive Select in SqlMap throws java.sql.SQLException: Exhausted Resultset
Date Wed, 25 Feb 2009 14:50:25 GMT
Hi Guys,

This is the first time I used Ibatis in a project and I'm stucked on this
error. "Exhausted Resultset".
My problem started when i designed my model class like the following:

class MyObject {
   private String id;
   private String parentId;
   private String rootId;
   private MyObject root;
   private MyObject parent;
   private List<MyObject> children;

 ---  Getters and Setters Here for all attributes.---
}


My SQL Map Looks like this:

<resultMap id="result" class="MyObject">
   <result property="id" column="ID" />
   <result property="parent" column="ID" select="MyObject.getChildren" />
   <result property="parent" column="PARENT_ID"
select="MyObject.getMyObjectById" />
   <result property="root" column="ROOT_ID"
select="MyObject.getMyObjectById" />
</resultMap>

<select id="getChildren" parameterClass="java.lang.String"
resultMap="result">
   SELECT ID, ROOT_ID, PARENT_ID FROM MY_OBJECT WHERE PARENT_ID = #value#
</select>

<select id="getMyObjectById" parameterClass="java.lang.String"
resultMap="result">
   SELECT ID, ROOT_ID, PARENT_ID FROM MY_OBJECT WHERE  ID = #value#
</select>

==============================================================

In the stacktrace it says

javax.servlet.ServletException: SqlMapClient operation; uncategorized
SQLException for SQL []; SQL state [null]; error code [17011];
.
.
.

java.sql.SQLException: Exhausted Resultset


When I remove this line "<result property="root" column="ROOT_ID"
select="MyObject.getMyObjectById" />" from the resultmap, the code works
fine.

Hope you could help me guys! Thanks in advance.


Sean

Mime
View raw message