前阵子看到有到一些朋友因为jbpm3不支持注解功能而范愁,所以把我改好的jdpl和方法分享一下。
不支持注解功能的原因:
JDPL.jar 包中实例化Configuration 时,源代码为Configuration configuration = new Configuration();,由此实例化后的配置无法识别Hibernate3.2所支持的标注。
1.org\jbpm\ant\AntHelper.java
2.org\jbpm\db\hibernate\HibernateHelper.java
3.org\jbpm\db\JbpmSchema.java
4.org\jbpm\db\compatibility\JbpmSchemaUpdate.java
5.org\jbpm\db\JbpmSessionFactory.java
不支持注解功能的原因:
JDPL.jar 包中实例化Configuration 时,源代码为Configuration configuration = new Configuration();,由此实例化后的配置无法识别Hibernate3.2所支持的标注。
1.org\jbpm\ant\AntHelper.java
public static Configuration getConfiguration(String hibernateCfgResource, String hibernatePropertiesResource) {
Object key = getKey(hibernateCfgResource,hibernatePropertiesResource);
Configuration configuration = (Configuration) configurations.get(key);
if (configuration==null) {
log.debug("creating hibernate configuration from cfg '"+hibernateCfgResource+"' and properties '"+hibernatePropertiesResource+"'");
configuration = new AnnotationConfiguration();
2.org\jbpm\db\hibernate\HibernateHelper.java
public static Configuration createConfiguration(String cfgXmlResource, String propertiesResource) {
Configuration configuration = new AnnotationConfiguration();
3.org\jbpm\db\JbpmSchema.java
static Configuration createConfiguration(String[] args, int index) {
String hibernateCfgXml = (args.length>index ? args[index] : "hibernate.cfg.xml");
String hibernateProperties = (args.length>(index+1) ? args[index+1] : null);
Configuration configuration = new AnnotationConfiguration();
4.org\jbpm\db\compatibility\JbpmSchemaUpdate.java
public static void main(String[] args) {
try {
Configuration cfg = new AnnotationConfiguration();
5.org\jbpm\db\JbpmSessionFactory.java
public static Configuration createConfiguration(String configResource) {
Configuration configuration = null;
// create the hibernate configuration
configuration = new AnnotationConfiguration();