1 |
select * from person where name = 'unmi' |
iBatis 开发指南告诉我们,当 Person 对象的 name 属性不为 null 时启用 name 查询条件在映射文件 person.xml 中的配置为
1 2 3 4 5 6 7 8 |
<select id="getPersonsByName" resultClass="com.unmi.Person"> select id as id,name as name,passwd as passwd from person <dynamic prepend="WHERE"> <isNotNull prepend="AND" property="name"> (name like #name#) </isNotNull> </dynamic> </select> |