You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by zkn <zk...@abv.bg> on 2009/02/27 20:20:50 UTC

Re: Recursive Select in SqlMap throws java.sql.SQLException: Exhausted Resultset

Just a guess: could the problem be when selecting the root node  
because parent_id is null?

On 25.02.2009, at 16:50, Sean Barbridge wrote:

> 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];
> .