1、配置文件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" >
<sqlMap namespace="dbo_Hishop_Oren" >
<resultMap id="OrderRetuenResult" class="com.temp.model.OrderRetuenModel" >
<result column="RetuId" property="retuid" jdbcType="VARCHAR" />
<result column="OrderId" property="orderid" jdbcType="VARCHAR" />
<result column="UserId" property="userid" jdbcType="INTEGER" />
<result column="LinkMan" property="linkman" jdbcType="VARCHAR" />
</resultMap>
<sql id="Where_Clause" >
<isNotEmpty prepend="and" property="retuid" >
RetuId = #retuid:VARCHAR#
</isNotEmpty>
<isNotEmpty prepend="and" property="orderid" >
OrderId = #orderid:VARCHAR#
</isNotEmpty>
<isNotEmpty prepend="and" property="userid" >
UserId = #userid:INTEGER#
</isNotEmpty>
<isNotEmpty prepend="and" property="linkman" >
LinkMan = #linkman:VARCHAR#
</isNotEmpty>
<isNotEmpty property="criteria" >
<iterate property="criteria" conjunction="and" prepend="and" open="(" close=")" >
$criteria[].paramName$ $criteria[].arithmeticType$ #criteria[].paramValue#
</iterate>
</isNotEmpty>
</sql>
其中property=的值都是javaBean中的属性字段名,一定要与java Bean中的属性名相一致的,【是要注意大小写的】否则会出现错误异常,到头来找错误也不好找,所以要切记
写sql语句进行数据库的增删改查操作时,对字段名的大小写没有什么强制性的要求,大写Or小写都可以将进行相应的操作的,