Hi,

    I have to fetch a list from 2 tables based on below condition.

 

[code]

-------------------

Service class

-------------------

fileParameters.put("Project_Code",projectCode);

fileParameters.put("Files_ID",filePk);

responseFileData =
(List)sqlMap.queryForList("getFileResponses",fileParameters);

 

-------------------------------------------------------
query.xml

<parameterMap id="FileDetails" class="java.util.Map" >                          
                     
                <parameter property="Project_Code" jdbcType="VARCHAR" />
                <parameter property="Files_ID" jdbcType="INT" />
</parameterMap>

                                 

<resultMap id="get_list" class="com.hcl.fpTool.pojo.ResponseFilesDataPOJO">
            <result property="rule_Id" column="Rule_Id"/>           
            <result property="response" column="Response"/>                     
   
            <result property="remarks" column="Remarks"/>                       
 
/resultMap>

<select id="getFileResponses"
resultClass="com.hcl.fpTool.pojo.ResponseFilesDataPOJO"
parameterMap="FileDetails" resultMap="get_list">                    

            select bres.rule_id, bstatic.rule_desc,bres.remarks,
bres.response 
            from BusinessRule_ResFiles_Data bres, BusinessRule_StaticData
bstatic
            where  project_Code = ? and files_id = ?
            and bres.rule_id = bstatic.rule_id and bres.rule_id not like
('%CD%')                                        
 </select>

 

The problem lies here is 
1> i need  to select "bstatic.rule_desc"  from my another table
"BusinessRule_StaticData"
2>i need to select "bres.rule_id" from my another table
"BusinessRule_ResFiles_Data"

 so i have a total select of 4 columns based on a join of 2 tables.

so please help me to correct the "query.xml" file such that i can accomplish
the selection of 4 columns and retrieve it back as a list in my service
class



-- 
View this message in context: 
http://old.nabble.com/Issue-with-join-of-2-tables-in-Ibatis-tp26612861p26612861.html
Sent from the iBATIS - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ibatis.apache.org
For additional commands, e-mail: dev-h...@ibatis.apache.org

Reply via email to