<plugins> <plugin interceptor="com.rrtong.frame.dao.PaginationInterceptor"> <property name="dialect" value="oracle"></property> </plugin> </plugins>
/*以下得到的是要执行的sql语句,并不是配置的sql语句*/ StatementHandler statementHandler = (StatementHandler)invocation.getTarget(); BoundSql boundSql = statementHandler.getBoundSql(); String originalSql = boundSql.getSql();
https://mybatis.googlecode.com/files/mybatis-spring-1.2.1.zip
mybatis 配置文件中的参数绑定区分大小写,必须与传递的参数名保持一致
1、设定entity的数据类型与数据库类型一致
2、在sql中定义参数的数据类型,比如
where userCode = #{userCode, jdbcType=VARCHAR}
<resultmap id="Archive" type="Archive"> <id column="ARCHIVESKEY" property="archiveKey"></id> <result column="title" property="archiveTitle"></result> </resultmap>
<p> <selectkey keyproperty="archiveKey" order="BEFORE" resulttype="String"> SELECT SEQ_ARCHIVE.NEXTVAL FROM DUAL </selectkey></p>
<insert id="insertUser" usegeneratedkeys="true" keyproperty="userId" parametertype="com.mybatis.User"> insert into user(userName,password) values(#{userName},#{password}) </insert>
<resultmap id="Archive" type="Archive"> <id property="archiveKey"></id> <result column="title" property="archiveTitle"></result> </resultmap> <select id="getArchive" parametertype="HashMap" resultmap="Archive"> select SPAARCHIVESKEY, TITLE from Archives where USERCODE = #{userCode, jdbcType=VARCHAR} And VALID= #{valid, jdbcType=VARCHAR} </select>
<update id="updateArchive" parametertype="Archive"> update Tbl_ARCHIVES set title = #{archiveTitle}, content = #{content}, feeValue = #{feeValue} security = #{security}, subjectType = #{subjectType}, gradeType = #{gradeType}, gather = #{gather}, archiveType = #{archiveType}, keyWordName = #{keyWordName} where archivesKey = #{archiveKey} </update>
<delete id="deleteArchive" parametertype="String"> delete from title where spaArchivesKey = #{archiveKey}</delete>