ibatis的参数映射

1.自动参数映射
<insert id="inserUser" parameterClass="User">
  insert into t_user(id, name, sex, address) 
              values (#id#, #name#, #sex#, #address#)
</insert>


2.内联参数映射
<insert id="inserUser3" parameterClass="User">
  insert into t_user(id, name, sex, address) 
  values (#id:NUMBER#, #name:VARCHER#, #sex:NUMBER#, #address:NUMBER#)
</insert>


3.外联参数映射
<parameterMap class="User" id="paramMap">
  <parameter property="id" jdbcType="NUMBER"/>
  <parameter property="name" jdbcType="VERACHER"/>
  <parameter property="sex" jdbcType="NUMBER"/>
  <parameter property="address" jdbcType="NUMBER"/>
</parameterMap>
  
<insert id="inserUser" parameterMap="paramMap">
  insert into t_user(id, name, sex, address) values (?, ?, ?, ? )
</insert>

你可能感兴趣的:(xml,ibatis)