Flowable 6.6.0 使用者指南相關文檔下載下傳
- BPMN使用者指南 第一部分 - 中文PDF精編版
- BPMN使用者指南 第二部分 - 中文PDF精編版
- BPMN使用者指南 第三部分 - 中文PDF精編版
- 應用程式指南 - 中文PDF精編版
- 應用程式指南 - 中英對照PDF精編版
- 應用程式指南 - Eclipse設計器中文PDF精編版
- 表單使用者指南 - 中文PDF精編版
- 事件系統資料庫使用者指南 - 中文PDF精編版
《Flowable 6.6.0 BPMN使用者指南》
1. 入門
2. 配置
3 The Flowable API
4 Flowable 6.6.0 BPMN使用者指南 - (4)Spring內建
5 Spring Boot
6 部署
7 BPMN 2.0簡介
8 BPMN 2.0的構造
9 表單(Forms)
10 流程執行個體遷移
11 JPA
11.1 要求
11.2 配置
11.3 用法
- 11.3.1 簡單示例
- 11.3.2 查詢JPA流程變量
- 11.3.3 使用Sping Bean和JPA的複雜示例
有關Flowable的更多文檔,參見:
《Flowable文檔大全》
11.2 配置
To be able to use JPA-entities, the engine must have a reference to an EntityManagerFactory. This can be done by configuring a reference or by supplying a persistence-unit name. JPA-entities used as variables will be detected automatically and will be handled accordingly.
The example configuration below uses the jpaPersistenceUnitName:
為了能夠使用JPA實體,引擎必須具有對EntityManagerFactory的引用。這可以通過配置引用或提供persistence-unit名稱來完成。将自動檢測用作變量的JPA實體,并相應地進行處理。
下面的示例配置使用jpaPersistenceUnitName:
<bean id="processEngineConfiguration"
class="org.flowable.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<!-- Database configurations -->
<property name="databaseSchemaUpdate" value="true" />
<property name="jdbcUrl" value="jdbc:h2:mem:JpaVariableTest;DB_CLOSE_DELAY=1000" />
<property name="jpaPersistenceUnitName" value="flowable-jpa-pu" />
<property name="jpaHandleTransaction" value="true" />
<property name="jpaCloseEntityManager" value="true" />
<!-- job executor configurations -->
<property name="asyncExecutorActivate" value="false" />
<!-- mail server configurations -->
<property name="mailServerPort" value="5025" />
</bean>
The next example configuration below provides a EntityManagerFactory which we define ourselves (in this case, an open-jpa entity manager). Note that the snippet only contains the beans that are relevant for the example, the others are omitted. Full working example with open-jpa entity manager can be found in the flowable-spring-examples (/flowable-spring/src/test/java/org/flowable/spring/test/jpa/JPASpringTest.java)
下面的配置示例提供了一個我們自己定義的EntityManagerFactory(在本例中,是一個open-jpa實體管理器)。注意,代碼片段隻包含與示例相關的bean,其他的都被省略了。open-jpa實體管理器的完整工作示例可以在flowable-spring-examples中找到(/flowablespring/src/test/java/org/flowable/spring/test/jpa/JPASpringTest.java)
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="pum"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
<property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.H2Dictionary" />
</bean>
</property>
</bean>
<bean id="processEngineConfiguration" class="org.flowable.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jpaEntityManagerFactory" ref="entityManagerFactory" />
<property name="jpaHandleTransaction" value="true" />
<property name="jpaCloseEntityManager" value="true" />
<property name="asyncExecutorActivate" value="false" />
</bean>
The same configurations can also be done when building an engine programmatically, example:
在以程式設計方式建構引擎時,也可以執行相同的配置,例如:
ProcessEngine processEngine = ProcessEngineConfiguration
.createProcessEngineConfigurationFromResourceDefault()
.setJpaPersistenceUnitName("flowable-pu")
.buildProcessEngine();
Configuration properties:
- jpaPersistenceUnitName: The name of the persistence-unit to use. (Make sure the persistence-unit is available on the classpath. According to the spec, the default location is /META-INF/persistence.xml). Use either jpaEntityManagerFactory or jpaPersistenceUnitName.
- jpaEntityManagerFactory: An reference to a bean implementing javax.persistence.EntityManagerFactory that will be used to load the Entities and flushing the updates. Use either jpaEntityManagerFactory or jpaPersistenceUnitName.
- jpaHandleTransaction: Flag indicating that the engine should begin and commit/rollback the transaction on the used EntityManager instances. Set to false when Java Transaction API (JTA) is used.
- jpaCloseEntityManager: Flag indicating that the engine should close the EntityManager instance that was obtained from the EntityManagerFactory. Set to false when the EntityManager is container-managed (e.g. when using an Extended Persistence Context which isn’t scoped to a single transaction’).
配置屬性:
- jpaPersistenceUnitName:要使用的持久性單元(persistence-unit)的名稱。(確定持久性單元在classpath上可用。根據規範,預設位置是/META-INF/persistence.xml)。使用jpaEntityManagerFactory 或jpaPersistenceUnitName。
- jpaEntityManagerFactory:對實作javax.persistence.EntityManagerFactory的bean的引用,EntityManagerFactory将用于加載實體和重新整理更新。使用jpaEntityManagerFactory或jpaPersistenceUnitName。
- jpaHandleTransaction:标志,用于訓示引擎是否應該在所使用的EntityManager 執行個體上開始并送出/復原事務。使用 Java Transaction API(JTA)時設定為false。
- jpaCloseEntityManager:标志,用于訓示引擎是否應關閉EntityManager執行個體(從EntityManagerFactory擷取的)。當EntityManager 是容器管理的(例如,當使用擴充的持久性上下文(Extended Persistence Context),它的作用域不局限于單個事務時),設定為false。