ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Datta <datta.s...@gmail.com>
Subject RE: Exception occured in iBatis Dynamic queries and resultMap
Date Thu, 07 Sep 2006 09:05:13 GMT

Hi 
Thanks for your valuable inputs........
But it worked me the otherway like
in java code I have written like:
Employee e=new Employee();
e.setDeptNo("9");Employee emp =
	(Employee)sqlMap.queryForObject("getEmployee",e);
        System.out.println("Employee No = " + emp.getEmpNo());
        System.out.println("Dept Name = " + emp.getDname());
.........then it worked fine.
Thanks anyways   





Niels Beekman-2 wrote:
> 
> You have not specified the parameterClass-attribute, so there is only
> one parameter, you can refer to it by using "#value#" instead of
> "#deptno#".
> 
> Niels
> 
> -----Original Message-----
> From: Datta [mailto:datta.saru@gmail.com] 
> 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.
> 
> 
> 

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


Mime
View raw message