---
title: "jbpm与AgileFlow的hibernate持久化实现方式对比"
author: "hongsoft"
date: "2005-02-21T12:00:00Z"
tags: []
slug: "jbpm-agileflow-hibernate"
draft: false
lastmod: "2005-02-21T12:00:00Z"
id: 287490
url: "https://hongsoft.iteye.com/blog/287490"
---

jbpm3的持久化实现基于hibernate3,由于与jboss的关系,估计以后要  
采用ejb3方式的实现;而它目前的实现,与AgileFlow的方式基本类同:

1)JbpmSessionFactory  
JbpmSessionFactory按顺序先后从下面的文件中读取hibernate.cfg.xml  
的位置:  
a)用户指定    buildDbSessionFactory(String configResource)  
b)从jbpm.properties中指定  
      if (configResource==null) {  
        configResource = JbpmConfiguration.getString("jbpm.hibernate.cfg.xml");  
      }  
c)按hibernate自己的处理方式:从classes目录下查找  
JbpmSessionFactory封装了Configure和SessionFactory.

2)JbpmSession  
JbpmSession封装了JbpmSessionFactory,Session,Transaction,这样可以在  
JbpmSession中获取JbpmSessionFactory并产生其它的连接

AgileFlow只对外提供了两个方法:  
1)AgileFlow.connectToServer();  
它将产生Session,可能开始事务;在后面的代码中可以获取当前的连接.  
2)AgileFlow.disConnectServer();  
结束事务,关闭Session.

就对用户的方便性而言,我还是认为AgileFlow的实现要好些.