jbpm架構的預設ORM架構是Hibernate
一個jbpm項目所需要的jar包:
hibernate需要的jar包antlr asm asm-attrs cglib commons-collections commons-logging dom4j ehcache jdbc2_0-stdext jta hibernate3 hibernate-tools hibernate-annotations hibernate-entitymanager hibernate-javassist
以及JDBC等項目所需要的jar包
1、建立項目并引用上述jar包;
2、在項目中添加jbpm.cfg.xml檔案,該檔案為jbpm配置檔案,可以從jbpm開發檔案夾中找到此檔案。一般,該檔案應該存放在項目的classpath中;
3、在項目中添加hibernate.cfg.xml檔案。當使用JbpmConfiguration的createSchema()方法來初始化jbpm資料表時需要hibernate.cfg.xml檔案,并且在初始化之前需要将jbpm所需要的實體類的mapping資訊添加到hibernate.cfg.xml。實體類的mapping資訊可以從jbpm開發檔案夾中找到(就是找到相同的hibernate.cfg.xml檔案并打開,隻copy其中jbpm用得到的部分);
4、使用jUnit編寫一個測試,用來初始化jbpm資料表。代碼如下:
@Test
public void initJbpmSchema() {
JbpmConfiguration jbpmCfg = JbpmConfiguration.getInstance();
jbpmCfg.createSchema();
}
本文轉自 rickqin 51CTO部落格,原文連結:http://blog.51cto.com/rickqin/278884