NutzCN Logo
问答 nutz dao fetch 在MySQL5.6报错?
发布于 2771天前 作者 ensean 2166 次浏览 复制 上一个帖子 下一个帖子
标签:

代码如下

UserOpenId userOpenId = ApplicationContext.ioc.get(UserOpenIdManager).fetch(Cnd.where('openId', '=', ticket))

本地MySQL 5.5没啥问题,上到腾讯云MySQL5.6,运行报错如下, 看着像是SQL语句转换出问题了?

org.nutz.dao.DaoException: !Nutz SQL Error: 'SELECT * FROM (SELECT ROW_NUMBER() OVER() AS ROWNUM, T.* FROM ( SELECT * FROM user_open_id  WHERE open_id='oVamkuDlM0ZImtY1RAGXmIrC4rm0') T) AS A WHERE ROWNUM BETWEEN 1 AND 1 '
PreparedStatement: 
'SELECT * FROM (SELECT ROW_NUMBER() OVER() AS ROWNUM, T.* FROM ( SELECT * FROM user_open_id  WHERE open_id=?) T) AS A WHERE ROWNUM BETWEEN 1 AND 1 '
CaseMessage=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 '() AS ROWNUM, T.* FROM ( SELECT * FROM user_open_id  WHERE open_id='oVamkuDlM0ZI' at line 1
        at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:104)
        at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
        at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
        at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
        at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
        at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
        at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:125)
        at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:92)
        at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:81)
        at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
        at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:248)
        at org.nutz.dao.impl.NutDao.fetch(NutDao.java:556)
        at org.nutz.service.EntityService.fetch(EntityService.java:186)
        at org.nutz.service.EntityService$fetch.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at com.maiqing.wx.filter.TicketFilter.match(TicketFilter.groovy:33)
        at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:50)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at com.maiqing.common.nutz.web.processor.ServletInitProcessor.process(ServletInitProcessor.java:11)
        at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
        at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
        at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
        at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: 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 '() AS ROWNUM, T.* FROM ( SELECT * FROM user_open_id  WHERE open_id='oVamkuDlM0ZI' at line 1
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.Util.getInstance(Util.java:408)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
        at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2714)
        at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeQuery(FilterEventAdapter.java:465)
        at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeQuery(FilterChainImpl.java:2711)
        at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeQuery(PreparedStatementProxyImpl.java:145)
        at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:227)
        at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:272)
        at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53)
        ... 50 more

5 回复

打算换1.r.61不?

现在是1.r.60,我升一下试试。

解决了,还真就是 r.61修复的bug么。。。

@ensean 你可以看看release note

DB2.......我说这 ROW_NUMBER OVER咋看着这么眼熟。。。。

谢兽总。。。

添加回复
请先登陆
回到顶部