query怎么老抱这个错?

心中自有伯乐在 发布于 2013/10/17 15:59
阅读 235
收藏 0

华为云11月刊推送:DIY微信问答机器人,高性能计算代码的20个技巧!>>>

rg.hibernate.exception.SQLGrammarException: could not execute query
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.loader.Loader.doList(Loader.java:2536)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
 at org.hibernate.loader.Loader.list(Loader.java:2271)
 at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
 at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
 at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
 at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
 at com.ctc.ema.thread.DealFlowThread.noticeInterface(DealFlowThread.java:736)
 at com.ctc.ema.thread.DealFlowThread.insertSendTj(DealFlowThread.java:701)
 at com.ctc.ema.thread.DealFlowThread.tjSmsReport(DealFlowThread.java:953)
 at com.ctc.ema.thread.DealFlowThread.doSmsSendFlow(DealFlowThread.java:855)
 at com.ctc.ema.thread.DealFlowThread.executeWork(DealFlowThread.java:149)
 at com.ctc.ema.thread.DealFlowThread.run(DealFlowThread.java:116)
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 'FROM SendTj WHERE chan.channelId IN(1) AND tjtime = '2013-10-17 00:00:00' GROUP ' at line 1
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
 at com.mysql.jdbc.Util.getInstance(Util.java:386)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
 at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
 at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281)
 at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
 at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
 at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
 at org.hibernate.loader.Loader.doQuery(Loader.java:802)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
 at org.hibernate.loader.Loader.doList(Loader.java:2533)
 ... 12 more
[2013-10-20 00:10:45,330] INFO                     thread.DealFlowThread:258  - 短信下行统计失败
[2013-10-20 00:10:45,366] ERROR                    thread.DealFlowThread:880  -
org.hibernate.exception.SQLGrammarException: could not execute query
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.loader.Loader.doList(Loader.java:2536)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
 at org.hibernate.loader.Loader.list(Loader.java:2271)
 at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
 at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
 at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
 at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
 at com.ctc.ema.thread.DealFlowThread.noticeInterface(DealFlowThread.java:736)
 at com.ctc.ema.thread.DealFlowThread.insertSendTj(DealFlowThread.java:701)
 at com.ctc.ema.thread.DealFlowThread.tjSmsReport(DealFlowThread.java:953)
 at com.ctc.ema.thread.DealFlowThread.doSmsSendFlow(DealFlowThread.java:855)
 at com.ctc.ema.thread.DealFlowThread.executeWork(DealFlowThread.java:149)
 at com.ctc.ema.thread.DealFlowThread.run(DealFlowThread.java:116)
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 'FROM SendTj WHERE chan.channelId IN(1) AND tjtime = '2013-10-17 00:00:00' GROUP ' at line 1
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
 at com.mysql.jdbc.Util.getInstance(Util.java:386)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
 at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
 at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281)
 at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
 at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
 at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
 at org.hibernate.loader.Loader.doQuery(Loader.java:802)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
 at org.hibernate.loader.Loader.doList(Loader.java:2533)
 ... 12 more
[2013-10-20 00:10:55,370] ERROR                    thread.DealFlowThread:126  - 发生异常,休眠10秒:
org.hibernate.exception.SQLGrammarException: could not execute query
 at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
 at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
 at org.hibernate.loader.Loader.doList(Loader.java:2536)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
 at org.hibernate.loader.Loader.list(Loader.java:2271)
 at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
 at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
 at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
 at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
 at com.ctc.ema.thread.DealFlowThread.noticeInterface(DealFlowThread.java:736)
 at com.ctc.ema.thread.DealFlowThread.insertSendTj(DealFlowThread.java:701)
 at com.ctc.ema.thread.DealFlowThread.tjSmsReport(DealFlowThread.java:953)
 at com.ctc.ema.thread.DealFlowThread.doSmsSendFlow(DealFlowThread.java:855)
 at com.ctc.ema.thread.DealFlowThread.executeWork(DealFlowThread.java:149)
 at com.ctc.ema.thread.DealFlowThread.run(DealFlowThread.java:116)
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 'FROM SendTj WHERE chan.channelId IN(1) AND tjtime = '2013-10-17 00:00:00' GROUP ' at line 1
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
 at com.mysql.jdbc.Util.getInstance(Util.java:386)
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
 at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
 at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2281)
 at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
 at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
 at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
 at org.hibernate.loader.Loader.doQuery(Loader.java:802)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
 at org.hibernate.loader.Loader.doList(Loader.java:2533)
 ... 12 more
加载中
0
皛尛惢
皛尛惢
FROM SendTj WHERE chan.channelId IN(1) AND tjtime = '2013-10-17 00:00:00' GROUP  这句执行出错
0
純白陰影
純白陰影
SQL语法错误
0
逝水fox
逝水fox
打开Hibernate的show sql,看这句的sql是什么
0
心中自有伯乐在
心中自有伯乐在
郁闷了,其实语法没写错,返回的对象错了,刚老大帮我纠正了。
0
豆豆爸
豆豆爸
'chan.'这个别名从何而来?为什么在From子句中没有该表?
心中自有伯乐在
心中自有伯乐在
@lixin3811 ...SORRY 。 急了、。
豆豆爸
豆豆爸
回复 @心中自有伯乐在 : 把你的hql和hibernate生成的SQL贴出来吧,那个问题一目了然。
心中自有伯乐在
心中自有伯乐在
噢,用的hql语句查询的
返回顶部
顶部