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