Activiti:nativeTaskQuery上的count方法

时间:2017-07-31 14:01:51

标签: java activiti

我创建了NativeTaskQuery:

NativeTaskQuery nativeCountQuery = taskService.createNativeTaskQuery().sql("SELECT task.* FROM BLABLA...");

listPage(0,10)方法正确返回结果的分页列表

count()方法抛出异常:

org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 27
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
        at org.activiti.engine.impl.db.DbSqlSession.selectOne(DbSqlSession.java:458)
        at org.activiti.engine.impl.persistence.entity.TaskEntityManager.findTaskCountByNativeQuery(TaskEntityManager.java:185)
        at org.activiti.engine.impl.NativeTaskQueryImpl.executeCount(NativeTaskQueryImpl.java:36)
        at org.activiti.engine.impl.AbstractNativeQuery.execute(AbstractNativeQuery.java:143)
        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)

该方法是否有问题?我如何计算NativeTaskQuery的结果?

0 个答案:

没有答案