更新删除相对简单点,只要属性和类型对应即可。
模板
<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">
本文介绍了一种简单的更新和删除操作实现方式,通过XML模板定义SQL语句来修改和删除数据库中的记录。使用预编译语句提高安全性,并设置了超时时间。
2089

被折叠的 条评论
为什么被折叠?



