论坛首页 Java企业应用论坛

jBPM和spring的事务整合

浏览 5475 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2007-12-17  
项目要用到jBPM。由于是不同数据库schema,所以使用了JTA。
当在把jBPM整合到spring的时候用到了spring-extensions(spring-modules)。
贴出来,各位看有什么不好的地方。

步骤:
1.jBPM -> spring
2.配置jta,并把jbpm和自己的bizniz纳入到jta里


applicationContext-jbpm.xml

	<bean id="jbpmDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown">
        <property name="dataSource">
            <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">
	            <property name="transactionManager" ref="jotm" />
				<property name="driverName"	value="${jbpm.jdbc.driverClassName}" />
				<property name="url" value="${jbpm.jdbc.url}" />
		    </bean>
        </property>
        <property name="user" value="${jbpm.jdbc.username}" />
		<property name="password" value="${jbpm.jdbc.password}" />
    </bean>
	
	
	<bean id="jbpmSessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref bean="jbpmDataSource" />
		</property>

		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.show_sql">false</prop>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQLInnoDBDialect
				</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
				<prop key="hibernate.connection.autocommit">false</prop>
			</props>
		</property>
		<property name="mappingResources">
			<list>
				<!-- hql queries and type defs -->
			    <value>org/jbpm/db/hibernate.queries.hbm.xml</value>
			    
			    <!-- graph.def mapping files -->
			    <value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value>
			    <value>org/jbpm/graph/def/Node.hbm.xml</value>
			    <value>org/jbpm/graph/def/Transition.hbm.xml</value>
			    <value>org/jbpm/graph/def/Event.hbm.xml</value>
			    <value>org/jbpm/graph/def/Action.hbm.xml</value>
			    <value>org/jbpm/graph/def/SuperState.hbm.xml</value>
			    <value>org/jbpm/graph/def/ExceptionHandler.hbm.xml</value>
			    <value>org/jbpm/instantiation/Delegation.hbm.xml</value>
			
			    <!-- graph.node mapping files -->
			    <value>org/jbpm/graph/node/StartState.hbm.xml</value>
			    <value>org/jbpm/graph/node/EndState.hbm.xml</value>
			    <value>org/jbpm/graph/node/ProcessState.hbm.xml</value>
			    <value>org/jbpm/graph/node/Decision.hbm.xml</value>
			    <value>org/jbpm/graph/node/Fork.hbm.xml</value>
			    <value>org/jbpm/graph/node/Join.hbm.xml</value>
			    <value>org/jbpm/graph/node/State.hbm.xml</value>
			    <value>org/jbpm/graph/node/TaskNode.hbm.xml</value>
			
			    <!-- context.def mapping files -->
			    <value>org/jbpm/context/def/ContextDefinition.hbm.xml</value>
			    <value>org/jbpm/context/def/VariableAccess.hbm.xml</value>
			
			    <!-- taskmgmt.def mapping files -->
			    <value>org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/def/Swimlane.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/def/Task.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/def/TaskController.hbm.xml</value>
			
			    <!-- module.def mapping files -->
			    <value>org/jbpm/module/def/ModuleDefinition.hbm.xml</value>
			
			    <!-- bytes mapping files -->
			    <value>org/jbpm/bytes/ByteArray.hbm.xml</value>
			
			    <!-- file.def mapping files -->
			    <value>org/jbpm/file/def/FileDefinition.hbm.xml</value>
			
			    <!-- scheduler.def mapping files -->
			    <value>org/jbpm/scheduler/def/CreateTimerAction.hbm.xml</value>
			    <value>org/jbpm/scheduler/def/CancelTimerAction.hbm.xml</value>
			
			    <!-- graph.exe mapping files -->
			    <value>org/jbpm/graph/exe/Comment.hbm.xml</value>
			    <value>org/jbpm/graph/exe/ProcessInstance.hbm.xml</value>
			    <value>org/jbpm/graph/exe/Token.hbm.xml</value>
			    <value>org/jbpm/graph/exe/RuntimeAction.hbm.xml</value>
			
			    <!-- module.exe mapping files -->
			    <value>org/jbpm/module/exe/ModuleInstance.hbm.xml</value>
			        
			    <!-- context.exe mapping files -->
			    <value>org/jbpm/context/exe/ContextInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/TokenVariableMap.hbm.xml</value>
			    <value>org/jbpm/context/exe/VariableInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml</value>
			    <value>org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml</value>
			
			    <!-- msg.db mapping files -->
			    <value>org/jbpm/msg/Message.hbm.xml</value>
			    <value>org/jbpm/msg/db/TextMessage.hbm.xml</value>
			    <value>org/jbpm/command/ExecuteActionCommand.hbm.xml</value>
			    <value>org/jbpm/command/ExecuteNodeCommand.hbm.xml</value>
			    <value>org/jbpm/command/SignalCommand.hbm.xml</value>
			    <value>org/jbpm/command/TaskInstanceEndCommand.hbm.xml</value>
			
			    <!-- taskmgmt.exe mapping files -->
			    <value>org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/exe/PooledActor.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml</value>
			
			    <!-- scheduler.exe mapping files -->
			    <value>org/jbpm/scheduler/exe/Timer.hbm.xml</value>
			
			    <!-- logging mapping files -->
			    <value>org/jbpm/logging/log/ProcessLog.hbm.xml</value>
			    <value>org/jbpm/logging/log/MessageLog.hbm.xml</value>
			    <value>org/jbpm/logging/log/CompositeLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/ActionLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/NodeLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/ProcessStateLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/SignalLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/TokenCreateLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/TokenEndLog.hbm.xml</value>
			    <value>org/jbpm/graph/log/TransitionLog.hbm.xml</value>
			    <value>org/jbpm/context/log/VariableLog.hbm.xml</value>
			    <value>org/jbpm/context/log/VariableCreateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/VariableDeleteLog.hbm.xml</value>
			    <value>org/jbpm/context/log/VariableUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml</value>
			    <value>org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/TaskLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml</value>
			    <value>org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml</value>
			</list>
		</property>
	</bean>

(省略了其他的jbpmconfiguration和flow的配置)


applicationContext-jta.xml
	<bean id="jotm"
		class="org.springframework.transaction.jta.JotmFactoryBean" />

	<bean id="transactionManager"
		class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="userTransaction" ref="jotm" />
	</bean>
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics