cancel
Showing results for 
Search instead for 
Did you mean: 

Mysql syntax error

hair888
Champ in-the-making
Champ in-the-making
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?
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
The problem is that the mybatis version does not match that of Activiti. We haven't upgraded to that version yet.

hair888
Champ in-the-making
Champ in-the-making
yes, thank you! And after I comment the mybatis pom dependency, it works fine.