Hi all,
I have just written this code for getting employee record based on deptno.
plz help with some good tutorials/books on iBatis for Dynamic
queries...........................
My sqlMap is:
<sqlMap namespace="Employee">
        <resultMap id="get-employee-result" class="src.Employee">
          <result property="empNo" column="empno" />
          <result property="empName" column="empname" />
          <result property="deptNo" column="deptNo" />
          <result property="dname" column="dname" />
         </resultMap>
        <select id="getEmployee" resultMap="get-employee-result">
                SELECT * FROM MYIBATISEMP       <dynamic prepend="WHERE">
                <isNotEmpty property="deptNo">
                        deptNo = #deptno#
                </isNotEmpty>
        </dynamic>
        </select>       
</sqlMap>
and the corresponding java code is:
String deptNo = "9";
Employee emp =
        (Employee)sqlMap.queryForObject("getEmployee",deptNo);
        System.out.println("Employee No = " + emp.getEmpNo());
        System.out.println("Dept Name = " + emp.getDname());
        System.out.println("Dept No = " + emp.getDeptNo());
        System.out.println("EmpName = " + emp.getEmpName());   
and the error am getting is:
======================================
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in maps/Employee.xml.  
--- The error occurred while preparing the mapped statement for execution.  
--- Check the getEmployee.  
--- Check the parameter map.  
--- Cause: com.ibatis.common.beans.ProbeException: There is no READABLE
property named 'deptNo' in class 'java.lang.String'
Caused by: com.ibatis.common.beans.ProbeException: There is no READABLE
property named 'deptNo' in class 'java.lang.String'.............

-- 
View this message in context: 
http://www.nabble.com/Exception-occured-in-iBatis-Dynamic-queries-and-resultMap-tf2221179.html#a6153351
Sent from the iBATIS - User - Java forum at Nabble.com.

Reply via email to