cancel
Showing results for 
Search instead for 
Did you mean: 

Error happend when I try to get tasks!Please help me.

looyli
Champ in-the-making
Champ in-the-making
Error message:
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: 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 'order by RES.ID_ asc 
    LIMIT 2147483647 OFFSET 0' at line 15
### The error may exist in org/activiti/db/mapping/entity/Task.xml
### The error may involve org.activiti.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria-Inline
### The error occurred while setting parameters
### SQL: select distinct RES.* from ACT_RU_TASK RES  WHERE  RES.ASSIGNEE_ = ?  order by  order by RES.ID_ asc  LIMIT ? OFFSET ?
### Cause: 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 'order by RES.ID_ asc 
    LIMIT 2147483647 OFFSET 0' at line 15
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
   at org.activiti.engine.impl.db.DbSqlSession.selectListWithRawParameter(DbSqlSession.java:426)
   at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:417)
   at org.activiti.engine.impl.persistence.entity.TaskEntityManager.findTasksByQueryCriteria(TaskEntityManager.java:135)
   at org.activiti.engine.impl.TaskQueryImpl.executeList(TaskQueryImpl.java:1189)
   at org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:158)
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
   at org.activiti.engine.impl.AbstractQuery.list(AbstractQuery.java:132)
   at net.sinocredit.fitp.workflow.WorkFlowServiceActivitiImpl.fetchTaskByUserid(WorkFlowServiceActivitiImpl.java:56)
   at net.sinocredit.fitp.workflow.WorkflowWaoTest.testFetchTaskByUserid(WorkflowWaoTest.java:33)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
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 'order by RES.ID_ asc 
    LIMIT 2147483647 OFFSET 0' at line 15
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
   at com.mysql.jdbc.Util.getInstance(Util.java:384)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082)
   at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1307)
   at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:62)
   at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:78)
   at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
   at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
   at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
   at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
   at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:120)
   … 41 more

3 REPLIES 3

looyli
Champ in-the-making
Champ in-the-making
below is the code:

taskService.createTaskQuery().taskAssignee(userid).list()

looyli
Champ in-the-making
Champ in-the-making
I found that "### SQL: select distinct RES.* from ACT_RU_TASK RES WHERE RES.ASSIGNEE_ = ? order by order by RES.ID_ asc LIMIT ? OFFSET ?".

Why there are two "order by"?

looyli
Champ in-the-making
Champ in-the-making
I have resolved the problem. The version of mybatis is wrong. I downgraded the version to 3.2.5 and it works.