2019-03-28 00:00:00.150 [DubboServerHandler-xx.xx.xx.xx:yyyy-thread-191] DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139) - ==> Preparing: SELECT id, job...skipping... ### The error may involve xx.yy.zz.XXXXMapper.loadExpress-Inline ### The error occurred while setting parameters ### SQL: select field as fieldName from table where field= ? order by id ASC limit 1 limit ?,? ### 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 'limit 0,50' at line 5 ; bad SQL grammar []; nested exception is 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 'limit 0,50' at line 5, dubbo version: 2.5.3, current host: 10.24.232.204 #-# org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. 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 'limit 0,50' at line 5 ### The error may exist in URL [jar:file:/usr/local/dubbo/xxx/lib/xxx-yyy-1.0.0.jar!/sqlMap/express/XXXXMapper.xml] ### The error may involve xx.yy.zz.XXXXMapper.loadExpress-Inline ### The error occurred while setting parameters ### SQL: select field as fieldName from table where field= ? order by id ASC limit 1 limit ?,? ### 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 'limit 0,50' at line 5 ; bad SQL grammar []; nested exception is 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 'limit 0,50' at line 5
我们来看一下方法实现代码
@Override public XXXVo loadExpress(param){ XXXEntity param = new XXXEntity(); param.setBusinessNo(businessNo); XXXEntity entity = XXXMapper.loadExpress(param); //省略无关代码 }
我们看一下sqlmap
<select id="loadExpress" parameterType="xx.yy.zz.XXXEntity" resultType="xx.yy.zz.XXXEntity"> select field as fieldName from table where business_no= #{businessNo} order by id ASC limit 1 </select>