Hi 
        I am having problem with fetching data using ibatis.  When there are 
children to a parent, parent also does not get returned.
Just to give you an  idea queries are something like this 

   <resultMap id="parentList" class="com.example.parentDto">
    <result property="id" column="PARENT_ID" columnIndex="1"/>
    <result property="description" column="DESCRIPTION" columnIndex="2"/>    
        <result property="childList" column="PARENT_ID" 
select="getChildrenList"/> 
  </resultMap>

  <resultMap id="childrenList" class="com.example.childDto">
        <result property="Id" column="child_ID"/>       
        <result property="frenchName" column="FRENCH_NAME"/>
        <result property="name" column="NAME"/>
  </resultMap>

<statement id="getParentList" resultMap="parentList" 
parameterClass="java.util.Map"><![CDATA[
                        SELECT 
                                id,
                                description
                        FROM 
                                Parent p
                        where           
                                p.EFFECTIVE_DATE <= SYSDATE
                                AND p.END_DATE > SYSDATE
  ]]> </statement>
 
  <statement id="getChildrenList" resultMap="childrenList">
          <![CDATA[ SELECT 
                                c.ID 
                                c.FRENCH_NAME, 
                                c.NAME
                         FROM 
                                Parent p,
                                Child c
                        WHERE 
                                p.ID = c.Parent_id
                                AND c.EFFECTIVE_DATE <= SYSDATE
                                AND c.END_DATE > SYSDATE
                                AND c.PARENT_ID = #value#  
 ]]> </statement>


Any immediate help will be highly appreciated.

Regards,
Aniket

Reply via email to