jbpm3.1.4与spring事务整合问题
os586
2012-05-28
为什么根据网上的教程配了后:
在jbpm_taskinstance表中会有两条记录。 其中的第二条记录,时间与第一条一致,但是数据记录中的actorid字段是null 跟踪了一下相关的输出SQL: 打印了是两条insert into jbpm_taskinstance记录 但是service层中的工作流的保存的地方确只进行了一次; 配置文件是这样的: jbpm.cfg.xml:放置在了classpath下了: <jbpm-context> <service name="persistence"> <factory> <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory"> <field name="isTransactionEnabled"><false/></field> <field name="isCurrentSessionEnabled"><true/></field> </bean> </factory> </service> <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" /> <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" /> <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" /> <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" /> </jbpm-context> spring配置文件: <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="namingStrategy"> <bean class="org.hibernate.cfg.ImprovedNamingStrategy" /> </property> <property name="mappingLocations"> <list> <!-- jbpm's hbm.xml --> <value>classpath*:/org/jbpm/**/*.hbm.xml</value> <!-- other hbm.xml --> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop> <prop key="hibernate.jdbc.batch_size">50</prop> <!-- <prop key="hibernate.cache.provider_configuration_file_resource_path">${hibernate.ehcache_config_file}</prop> --> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.connection.release_mode"> auto </prop> <prop key="hibernate.autoReconnect">true</prop> <prop key="hibernate.cglib.use_reflection_optimizer"> true </prop> </props> </property> <property name="packagesToScan" value="com.sdcncsi.entity.*" /> </bean> <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"> <property name="sessionFactory" ref="sessionFactory" /> <property name="configuration" value="classpath:/jbpm.cfg.xml" /> <!-- 第一处需要注意的地方 --> <!-- <property name="processDefinitions"> --> <!-- <list> 增加新流程定义在下面 --> <!-- <ref local="testWorkflow" /> --> <!-- </list> --> <!-- </property> <property name="createSchema" value="false" /> --> </bean> <bean id="testWorkflow" class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean"> <!-- property name="definitionLocation" value="classpath:testspring/processdefinition.xml" /> --> <!-- <property name="definitionLocation" value="classpath:audit/auditCheck/processdefinition.xml" /> --> <property name="definitionLocation" value="classpath:zfcg/processdefinition.xml" /> </bean> <bean id="flowUtils" class="com.sdcncsi.common.FlowUtils"> </bean> <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate"> <constructor-arg index="0" ref="jbpmConfiguration" /> <constructor-arg index="1" ref="testWorkflow" /> </bean> service层调用: JbpmContext jctx = jbpmTemplate.getJbpmConfiguration().createJbpmContext(); ProcessDefinition pdf = jctx.getGraphSession().findLatestProcessDefinition("lcgy"); pi = new ProcessInstance(pdf); pi.getContextInstance().setVariable("processer", nextProcesser); pi.getContextInstance().setVariable("jobs", Struts2Utils.getRequest().getAttribute("jobs")); pi.getContextInstance().setVariable("ins_id", pi.getId()); System.out.println("------------------------"+nextProcesser); pi.signal(); |
|
os586
2012-05-29
大家都没有碰到过这问题是不是啊?
|
|
os586
2012-05-30
os586 写道 大家都没有碰到过这问题是不是啊?
|