对于更改了XML文件,都要重启服务器才会生效,和注解一下..有更新注解的话.如WebService一定要重启才会生效..
用Begin end 语句批量更新或插入数据时. 不要忘记了把分号忘记了.今天遇到就是由于少了一个分号而导致操作错误的事情.找一半天原因..
对于Mybatis映射文件写SQL的时候,最好要SQLPlus测试一下..格式一定要统一,良好.跟SLPlus里写应该是一样的..经常项目中都会发现由于多一个,或少一个逗号或分号等而导致重启Tomcat等服务器的情况..从而浪费时间..因此建议,要有统一的格式:如下:我个人用的格式:
- <select id="dynamicIfTest" parameterType="Blog" resultType="Blog">
- select t.user,t.password,t.title,t.content,t.owner
- from t_blog t
- where 1 = 1
- <if test="title != null">
- and t.title = #{title}
- </if>
- <if test="content != null">
- and t.content = #{content}
- </if>
- <if test="owner != null">
- and t.owner = #{owner}
- </if>
- </select>