使用findExecutionById()的疑问

xyz20003 2010-03-22
<?xml version="1.0" encoding="UTF-8"?>

<process name="task" xmlns="http://jbpm.org/4.3/jpdl">

  <start g="11,99,48,48">
     <transition to="helloworld"/>
  </start>

  <task g="106,94,110,52" name="helloworld" assignee="Lingo">
    <transition to="end"/>
  </task>

  <end g="276,95,48,48" name="end"/>

</process>


package com.family168.jbpm4book.ch102;

import org.jbpm.api.*;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.*;

import org.jbpm.test.JbpmTestCase;


public class TaskTest extends JbpmTestCase {
    String deploymentDbid;

    protected void setUp() throws Exception {
        super.setUp();

        deploymentDbid = repositoryService.createDeployment()
                                          .addResourceFromClasspath("com/family168/jbpm4book/ch102/task.jpdl.xml")
                                          .deploy();
    }

    protected void tearDown() throws Exception {
        repositoryService.deleteDeploymentCascade(deploymentDbid);

        super.tearDown();
    }

    public void testHelloworld() {
        ProcessInstance processInstance = executionService
            .startProcessInstanceByKey("task");

        Task task = taskService.findPersonalTasks("Lingo").get(0);
        Execution execution = executionService.findExecutionById(task
                .getExecutionId());
        assertNotNull(execution);
    }
}



在hsqldb-1.8.0.10和mysql-5.0.77-community-nt都测试通过。

如果你们的环境下依然有问题,请提供具体的测试用例。
卡拉阿风 2010-03-23
使用你的测试用例在mysql5下报错:无法进行批量操作

org.hibernate.exception.GenericJDBCException: could not execute native bulk manipulation query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:198)
at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1190)
at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:357)
at org.jbpm.test.Db.clean(Db.java:135)
at org.jbpm.test.Db.verifyClean(Db.java:189)
at org.jbpm.test.JbpmTestCase.verifyDbClean(JbpmTestCase.java:155)
at org.jbpm.test.JbpmTestCase.tearDown(JbpmTestCase.java:96)
at com.family168.jbpm4book.ch102.TaskTest.tearDown(TaskTest.java:24)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Error on rename of '.\javaeyeoa\jbpm4_deployprop' to '.\javaeyeoa\#sql2-2e0-51' (errno: 152)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:189)
... 21 more
xyz20003 2010-03-23
Error on rename of '.\javaeyeoa\jbpm4_deployprop' to '.\javaeyeoa\#sql2-2e0-51' (errno: 152)

怎么出现这个问题?为什么需要改表名?
卡拉阿风 2010-03-23
xyz20003 写道
Error on rename of '.\javaeyeoa\jbpm4_deployprop' to '.\javaeyeoa\#sql2-2e0-51' (errno: 152)

怎么出现这个问题?为什么需要改表名?

表的名字都是使用原jbpm的建数据库的表产生的。未做任何修改
jbpm包下的hibernate配置文件也未做任何改动。
使用ssh搭建,jbpm的事务管理都交给spring来操作了。
卡拉阿风 2010-03-23
jbpm.cfg.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />

    <process-engine-context>
        <string name="spring.cfg" value="spring/applicationContext.xml" />
    </process-engine-context>
</jbpm-configuration>


jbpm.identity.cfg.xml配置,使用自己的权限管理系统
<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>
  <transaction-context>
     <object class="com.javaeye.oa.service.jbpm.IdentitySessionImpl"/>
  </transaction-context>
</jbpm-configuration>

app-jbpm.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />
<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />

</beans>

配置是这样的。其他未进行任何改动
xyz20003 2010-03-23
搞不清楚了
卡拉阿风 2010-03-23
xyz20003 写道
搞不清楚了

还是非常感谢临远大哥!!!
shusanzhan 2010-03-29
啊!我也遇到这样问题了,请问楼主问题解决了没有!我在Mysql5.0和SqlServer2000上面都有遇到同样的问题,我的应用环境是jbpm4.3,Spring2.0.
xyz20003 2010-03-29
强烈建议遇到问题的某一位同志把出错的用例发给我看一下,目前已经遇到4个同样的问题了。
saiyaren 2010-03-30
应该是hibernate包错了吧,我以前就用的3.2就直接找的就是dbid作为ID了
Global site tag (gtag.js) - Google Analytics