开发者社区> 问答> 正文

activiti5.17 默认查询的sql生成两个order by 关键字

项目集成Activiti5.17 MyBatis3.2.5 Spring3.2 hibernate4.2 几个类库, 启用activiti的默认查询任务时, 会出现:

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.CREATE_TIME_ asc   

    LIMIT 10 OFFSET 0' at line 30 

### 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                    left        join ACT_RU_IDENTITYLINK I on I.TASK_ID_ = RES.ID_                                                WHERE  RES.SUSPENSION_STATE_ = 1                                                                                                       and (RES.ASSIGNEE_ = ? or (RES.ASSIGNEE_ is null and (I.USER_ID_ = ?               or I.GROUP_ID_ IN (select g.GROUP_ID_ from ACT_ID_MEMBERSHIP g where g.USER_ID_ = ? ) ) ) )                order by  order by RES.CREATE_TIME_ 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.CREATE_TIME_ asc   

    LIMIT 10 OFFSET 0' at line 30。 

注意红色部分, 生成了两个order by 关键字。求大神解答, 在线等。

补充说明:

1、我单独使用activiti5+spring集成测试是没有问题的, 都正常。引入公司数据持久化的项目(mybatis+hibernate)后, 就出现了这个问题。

2、出现这个问题不稳定, 时好时坏。

3、求大神解答, 求大神解答, 求大神解答!

展开
收起
爵霸 2016-05-31 14:16:52 4226 0
2 条回答
写回答
取消 提交回答
  • 楼上正解,我也遇到这个问题

    2019-07-17 19:21:53
    赞同 1 展开评论 打赏
  • 这个bug是由于mybatis版本高了引起的,我遇到过。

    mybatis-3.2.8.jar就行 mybatis-3.3.0.jar就不行了

    2019-07-17 19:21:52
    赞同 2 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
SQL Server在电子商务中的应用与实践 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载