AnsweredAssumed Answered

Mysql syntax error

Question asked by hair888 on Jun 25, 2015
Latest reply on Jul 1, 2015 by hair888
hi all,
i am new to activiti, and after i set up the environment and try some simple code, but meet some strange error.
here is my code:
ProcessEngine processEngine = factoryBean.getObject(); //factoryBean is type of ProcessEngineFactoryBean
        Task task = processEngine.getTaskService().createTaskQuery().singleResult(); //throw exception here

error message:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is 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                                                                      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
   org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
   org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
   org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

environment:
spring: 4.0.2.RELEASE
mysql-connector-java: 5.1.18
activiti-engine: 5.17.0
mybatis: 3.3.0

my question is: why a simple task query generate a sql including 'order by' twice and throw a sql syntax exception of cause?

Outcomes