使用jfinal 4.3 和myql8,通过paginate做分页查询报错


这是原方法:

l=Db.paginate(Integer.parseInt(page),Integer.parseInt(limit),"select f_id,f_pro_name_1,f_start_year,f_end_year,f_fund_source,f_fund_perfor,f_por_basis,f_build_content,f_exp_orien,f_cent_office,f_manager_dep,f_distribution,f_add_time,f_remarker,f_No","from sys_fund");


打印出来的SQL

Sql: SELECT * FROM ( SELECT row_number() over (order by tempcolumn) temprownumber, * FROM  ( SELECT TOP 10 tempcolumn=0, f_id,f_pro_name_1,f_start_year,f_end_year,f_fund_source,f_fund_perfor,f_por_basis,f_build_content,f_exp_orien,f_cent_office,f_manager_dep,f_distribution,f_add_time,f_remarker,f_No from sys_fund)vip)mvp where temprownumber>0


这是报错信息:

[ERROR]-[Thread: XNIO-1 task-30]-[com.jfinal.core.ActionHandler.handle()]: com.gsgc.controller.fundmanager.FundSetController.findFundAll() : /fdset/findFundAll?page=1&limit=10

com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLSyntaxErrorException: 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 '* FROM  ( SELECT TOP 10 tempcolumn=0, f_id,f_pro_name_1,f_start_year,f_end_year,' at line 1


评论区

bb

2020-02-26 17:58

大神出来解答一下@JFinal

JFinal

2020-02-26 20:09

select top 是 Sql Server 数据库的方言,估计你的方言配置错误,要改成:
arp.setDialect(new MysqlDialect());

bb

2020-02-26 21:04

@JFinal 谢谢波总

热门反馈

扫码入社