cancel
Showing results for 
Search instead for 
Did you mean: 

About SQLServer Engine, can't get the Task category value

fuhang
Champ in-the-making
Champ in-the-making
I countered a problem. My Activiti use SQLServer2012 verson, When I get a Task, can't get the category property of that task, but When I use oracle, it's ok.
code :
TaskQuery taskQuery = taskService.createTaskQuery().taskAssignee( assignee );
….
task.getCategory() is null
the database ACT_RU_TASK table's CATEGORY_ column exists a varchar value, and the value length in 255.
the problem is not throwing any exception.

this is my configuration :
        <bean id="dataSourceDBCP" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
      <property name="url" value="jdbc:jtds:sqlserver://192.168.15.5:1433;DatabaseName=OA_NEW_IDEA;tds=8.0;lastupdatecount=true" />
      <!– <property name="username" value="sa" />
      <property name="password" value="TEAMteam9999" /> –>
      <property name="initialSize" value="25"/>
      <property name="maxActive" value="350"/>
      <property name="minIdle" value="5"/>
      <property name="maxIdle" value="35"/>
      <property name="removeAbandoned" value="true"/>
      <property name="removeAbandonedTimeout" value="180"/>
      <property name="maxWait" value="6000"/>
      <property name="testOnBorrow">
         <value>true</value>
      </property>
   </bean>
   
   <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
      <property name="dataSource" ref="dataSourceDBCP"/>
      <!– none, activity, audit, full –>
      <property name="history" value="none"/>
      <property name="bulkInsertEnabled" value="false"/>
      <property name="databaseType" value="mssql"/>
      <property name="activityFontName" value="宋体"/>
      <property name="labelFontName" value="宋体"/>
   </bean>


3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
That sounds very odd indeed.
Can you wrap your code in a unit test that fails on your installation so we can try it out?
Should be easy doable by creating a standalone task and giving it a category.

fuhang
Champ in-the-making
Champ in-the-making
I am sure task category value exists. I found the problem occurrence place. But I can't solve this. This is sample code:
*********************code*********************
              List<Task> result = null;
  if( StringUtils.isNotBlank( userId ) ) {
   String assignee = userId;
   TaskService taskService = getTaskService();
   TaskQuery taskQuery = taskService.createTaskQuery().taskAssignee( assignee );
   taskQuery = appendQueryCondition( taskQuery, condition );
  
                        // ! This is problem here, includeProcessVariables
   taskQuery = taskQuery.includeProcessVariables();

   result = taskQuery.listPage( page.getStart(), page.getLimit() );
   System.out.println( "===>" + result.get( 0 ).getCategory() );
                        // The print is ===>null
  }
  return result;
************************************************

When I commented out this "taskQuery = taskQuery.includeProcessVariables();" line, the running is nomal, geting the category value.
This is my process variables:
*******************database ACT_RU_VARIABLE*********************
ID_ REV_ TYPE_ NAME_ EXECUTION_ID_ PROC_INST_ID_ TASK_ID_ BYTEARRAY_ID_ DOUBLE_ LONG_ TEXT_ TEXT2_
30003 1 serializable contractNameList 30001 30001 NULL 30002 NULL NULL NULL NULL
30011 1 string unitId 30001 30001 NULL NULL NULL NULL ff808081511e3d1501511e40cac70001 NULL
30013 1 serializable applyDate 30001 30001 NULL 30012 NULL NULL NULL NULL

********************************************************************

Sorry for not pasting all of junit test codes.

jbarrez
Star Contributor
Star Contributor
I looked into the code, but when doing a .includeVariables, the task category is included.
Did a quick test, but for me the category is included:

<code>
  @Deployment(resources={"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"})
  public void testStartProcessInstanceWithVariables() {
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("basicType", new DummySerializable());
    runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
    Task task = taskService.createTaskQuery().includeProcessVariables().singleResult();
    assertNotNull(task.getProcessVariables());
    assertNotNull(task.getCategory());
  }
</code>