### The error may involve defaultParameterMap ### The error occurred while setting parameters
Posted lamsey16
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了### The error may involve defaultParameterMap ### The error occurred while setting parameters相关的知识,希望对你有一定的参考价值。
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Query was empty
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Query was empty]
今天用mybatis+pageHelp时发生这个错误,原因是:
错误代码:
public PageInfo<Log> getLogPage(Integer pageNum) { //设置每页显示数量 int pageSize = 5; PageHelper.startPage(pageNum, pageSize); //执行分页查询 NMRoutingToken token = new NMRoutingToken("LOG_DATA_SOURCE_KEY"); List<String> tableNameList = logMapper.selectAlltableName(); NMRoutingToken token1 = new NMRoutingToken("LOG_DATA_SOURCE_KEY"); List<Log> logList=logMapper.selectAllLog(tableNameList); //对获取的数据进行包装 int navigatePages = 6; PageInfo<Log> page = new PageInfo<>(logList, navigatePages); return page; }
正确:
public PageInfo<Log> getLogPage(Integer pageNum) { //执行分页查询 NMRoutingToken token = new NMRoutingToken("LOG_DATA_SOURCE_KEY"); List<String> tableNameList = logMapper.selectAlltableName(); NMRoutingToken token1 = new NMRoutingToken("LOG_DATA_SOURCE_KEY"); //设置每页显示数量 int pageSize = 5; PageHelper.startPage(pageNum, pageSize); List<Log> logList=logMapper.selectAllLog(tableNameList); //对获取的数据进行包装 int navigatePages = 6; PageInfo<Log> page = new PageInfo<>(logList, navigatePages); return page; }
pageHelp的页面设置应该在指定的sql前
以上是关于### The error may involve defaultParameterMap ### The error occurred while setting parameters的主要内容,如果未能解决你的问题,请参考以下文章
### The error may involve defaultParameterMap ### The error occurred while setting parameters
### The error may involve defaultParameterMap ### The error occurred while setting parameters
mybatis报错:The error may exist in xxxxMapper.xml
mybatis报错:The error may exist in xxxxMapper.xml
mybatis报错:The error may exist in xxxxMapper.xml
mybatis的小坑 ### The error may exist in com/vector/dao/*Mapper.xml