Do you have the DTD stuff, too? SqlMapConfig.xml: --- <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> ---
SqlMap.xml: --- <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> --- Larry On 9/5/06, Niels Beekman <[EMAIL PROTECTED]> wrote:
And you should replace the isNotEmpty with the isParameterPresent-element. Niels -----Original Message----- From: Datta [mailto:[EMAIL PROTECTED] Sent: dinsdag 5 september 2006 16:48 To: user-java@ibatis.apache.org Subject: Exception occured in iBatis Dynamic queries and resultMap 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-re sultMap-tf2221179.html#a6153351 Sent from the iBATIS - User - Java forum at Nabble.com.