Dynamic mapped statements......exceptions: Element "sqlMap" does not allow text.
--------------------------------------------------------------------------------
Key: IBATIS-342
URL: http://issues.apache.org/jira/browse/IBATIS-342
Project: iBatis for Java
Issue Type: Task
Components: SQL Maps
Environment:
WindowsXP,Myeclipse5.0,ibatis-common-2.jar,ibatis-dao-2.jar,ibatis-sqlmap-1-x.jar,ibatis-sqlmap-2.jar
and Datbase as SAPDB
Reporter: Datta Saru
Attachments: errors.txt
Hi all,
I want to use Dynamic sqlmaps in my application, what jars i need to add to my
classpath? This is my Employee.xml:
<resultMap id="get-emp-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-emp-result">
SELECT * FROM myibatisemp
<dynamic prepend="WHERE">
<isNotEmpty property="empNo">
empno = #empNo#
</isNotEmpty>
</dynamic>
</select>
and this is corresponding java code:
String empNo = "4";
Employee emp =
(Employee)sqlMap.executeQueryForObject(
"getEmployee",empNo);
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());
Plz suggest me some good tutorials on Dynamic sqlmaps with examples. The errors
are attached
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira