日期:2014-05-16  浏览次数:20393 次

Mybatis3更新和删除语句映射

更新删除相对简单点,只要属性和类型对应即可。

?

模板

?

	<update id="updateAuthor" parameterType="domain.blog.Author">
		update Author set
		username = #{username},
		password = #{password},
		email = #{email},
		bio = #{bio}
		where id = #{id} 
    </update>
	<delete id="deleteAuthor” parameterType=" int ">
		delete from Author where id = #{id} 
    </delete>

?

其属性值

?

?

<update 
 id="insertAuthor" 
 parameterType="domain.blog.Author" 
 flushCache="true" 
 statementType="PREPARED" 
 timeout="20000"> 

<delete 
 id="insertAuthor" 
 parameterType="domain.blog.Author" 
 flushCache="true" 
 statementType="PREPARED" 
 timeout="20000">