關於JBPM4.4與Spring整合

來源:互聯網
上載者:User

網路上針對相關的配置已經有很多說明,本文沒有針對springmodules.jar包。

1. spring內容相關的配置,!注意spring中要配置事務資訊

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

2. 關於自訂的identity配置,即許可權管理的幾個資料表,如下

在配置sessionFactory的時候,需要添加自訂identity.hbm.xml檔案(自己配置,不再說明),在jbpm.cfg.xml中配置你自訂的IdentitySession的實現

<!-- jbpm.cfg.xml --><jbpm-configuration> ......    <!--<import resource="jbpm.identity.cfg.xml" />-->     <transaction-context>    <hibernate-session current="true" />    <object class="your.IdentitySessionImpl"></object>  </transaction-context> </jbpm-configuration>

3. 通過spring.xml配置好sessionFactory之後,jbpm.hibernate.cfg.xml檔案可以不放到classpath下了,不過需要jbpm的特殊用途的時候,沒有做驗證。這裡請配置的朋友們,自行研究一下。

4. 在spring的上下文XML設定檔內,配置好jbpm的提供的Service的Bean就可以了

<!-- JBPM 4.4 --><bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper"><property name="jbpmCfg" value="jbpm.cfg.xml" /></bean><bean id="processEngine" factory-bean="springHelper"factory-method="createProcessEngine" /><bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"></bean><bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"></bean><bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService"></bean><bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"></bean><bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"></bean><bean id="managementService" factory-bean="processEngine" factory-method="getManagementService"></bean>

5. 配置完畢後,我的程式還出現了一個很頭疼的問題

開發環境:JDK1.6,Spring 3.0,JBPM 4.4,Hibernate 3.0,MySQL 5.0

問題描述:當我通過taskService.completeTask(taskId, translateName);,但是當任務為流程的最後一個結點的時候,出現了一個Execution外鍵的錯誤,不能刪除當前的Execution這條記錄。查看sql的執行日誌是因為在刪除Execution這條記錄之前,有一條更新操作的sql沒有執行。

問題原因:是因為hibernate的方言配置錯誤,應該採用 org.hibernate.dialect.MySQLInnoDBDialect ,而我使用的是org.hibernate.dialect.MySQLDialect

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.