@JFinal 波总 用sql查一张表是否存在时报错,之前的项目可以用的啊
sql:select * from information_schema.TABLES where TABLE_SCHEMA=(select database()) and `table_name` ='your table'
报错:
com.jfinal.plugin.activerecord.ActiveRecordException: java.lang.UnsupportedOperationException: Cannot support SQL for `schema.table`
at com.jfinal.plugin.activerecord.DbPro.find(DbPro.java:329)
at com.jfinal.plugin.activerecord.DbPro.findFirst(DbPro.java:355)
at com.jfinal.plugin.activerecord.DbPro.findFirst(DbPro.java:364)
at com.jfinal.plugin.activerecord.Db.findFirst(Db.java:301)
at com.ymm.project.model.examine.Examine.getTableNames(Examine.java:94)
at com.ymm.project.model.examine.Examine.adopt(Examine.java:64)
at com.ymm.project.controller.examine.ExamineController.adopt(ExamineController.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.jfinal.aop.Invocation.invoke(Invocation.java:75)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:81)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsupportedOperationException: Cannot support SQL for `schema.table`
at io.shardingjdbc.core.parsing.parser.clause.TableReferencesClauseParser.parseTableFactor(TableReferencesClauseParser.java:67)
at io.shardingjdbc.core.parsing.parser.dialect.mysql.clause.MySQLTableReferencesClauseParser.parseTableReference(MySQLTableReferencesClauseParser.java:24)
at io.shardingjdbc.core.parsing.parser.clause.TableReferencesClauseParser.parse(TableReferencesClauseParser.java:54)
at io.shardingjdbc.core.parsing.parser.sql.dql.select.AbstractSelectParser.parseTable(AbstractSelectParser.java:109)
at io.shardingjdbc.core.parsing.parser.sql.dql.select.AbstractSelectParser.parseFrom(AbstractSelectParser.java:98)
at io.shardingjdbc.core.parsing.parser.dialect.mysql.sql.MySQLSelectParser.parseInternal(MySQLSelectParser.java:50)
at io.shardingjdbc.core.parsing.parser.sql.dql.select.AbstractSelectParser.parseInternal(AbstractSelectParser.java:81)
at io.shardingjdbc.core.parsing.parser.sql.dql.select.AbstractSelectParser.parse(AbstractSelectParser.java:68)
at io.shardingjdbc.core.parsing.parser.sql.dql.select.AbstractSelectParser.parse(AbstractSelectParser.java:46)
at io.shardingjdbc.core.parsing.SQLParsingEngine.parse(SQLParsingEngine.java:50)
at io.shardingjdbc.core.routing.router.ParsingSQLRouter.parse(ParsingSQLRouter.java:74)
at io.shardingjdbc.core.routing.PreparedStatementRoutingEngine.route(PreparedStatementRoutingEngine.java:55)
at io.shardingjdbc.core.jdbc.core.statement.ShardingPreparedStatement.route(ShardingPreparedStatement.java:150)
at io.shardingjdbc.core.jdbc.core.statement.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:115)
at com.jfinal.plugin.activerecord.DbPro.find(DbPro.java:314)
at com.jfinal.plugin.activerecord.DbPro.find(DbPro.java:327)
... 32 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
SELECT COUNT(TABLE_NAME) AS counts FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ymm_lk_log_2' 这是我打印出的sql,在数据库里可以运行的
之前不是maven的项目可以用的,现在项目是maven jfinal3.6版本就报错了
谢谢波总,原因是shardingjdbc这的问题
注意观察最终的 sql,将里头的 :
`schema.table`
改成 :
`schema`.`table`
纯 sql 错误问题,与 jfinal 无关