ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: Problem with fetching data in one to many relationship
Date Thu, 18 Jan 2007 22:09:15 GMT
Remove CDATA in second request. The CDATA prevents your second request
from working.
Or better, remove it everywhere and use &gt; and &lt; instead of > and
<.
 
Christian

________________________________

From: Band, Aniket [mailto:Aniket.Band@CIBC.ca] 
Sent: Thursday, 18 January 2007 16:49
To: user-java@ibatis.apache.org
Subject: Problem with fetching data in one to many relationship



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 


Mime
View raw message