mybatis简单的分页查询语句,之前一直这么写,今天突然失败了
<select id="queryTest" parameterType="map" resultType="map">
select ...
limit #{offset} , #{limit}
</select>
以map中存放查询参数{"limit":10,"offset":0},异常信息:
org.springframework.jdbc.BadSqlGrammarException:
....
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0' , '10'' at line 9
猜测是公司dba升级了数据库,然后我手动指定了jdbcType=INTEGER发现还是一样的异常。
<select id="queryTest" parameterType="map" resultType="map">
select ...
limit #{offset,jdbcType=INTEGER} , #{limit,jdbcType=INTEGER}
</select>
各位,是不是我哪些错了?
这下就不会了,这样是不是就无法再用map传递参数了?