paulwong

          JBPM的雙數據源配置

          JBPM數據源和業務數據源不是同一個的時候的配置:


          <!-- jta config -->
              
          <!-- 業務數據庫 -->
              
          <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
                  init-method
          ="init" destroy-method="close">
                  
          <property name="uniqueResourceName">
                      
          <value>mysql/main</alue>
                  
          </property>
                  
          <property name="xaDataSourceClassName">
                      
          <value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</alue>
                  
          </property>
                  
          <property name="xaProperties">
                      
          <props>
                          
          <prop key="URL">${jdbc.url}</prop>
                          
          <prop key="user">${jdbc.username}</prop>
                          
          <prop key="password">${jdbc.password}</prop>
                      
          </props>
                  
          </property>
                  
          <property name="maxPoolSize">
                      
          <value>3</alue>
                  
          </property>
                  
          <property name="testQuery">
                      
          <value>SELECT 1</alue>
                  
          </property>
              
          </bean>

              
          <!-- JBPM數據庫 -->
              
          <bean id="dataSourceJbpm"
                  class
          ="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init"
                  destroy-method
          ="close">
                  
          <property name="uniqueResourceName">
                      
          <value>mysql/news</alue>
                  
          </property>
                  
          <property name="xaDataSourceClassName">
                      
          <value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</alue>
                  
          </property>
                  
          <property name="xaProperties">
                      
          <props>
                          
          <prop key="URL">${jbpm.jdbc.url}</prop>
                          
          <prop key="user">${jbpm.jdbc.username}</prop>
                          
          <prop key="password">${jbpm.jdbc.password}</prop>
                      
          </props>
                  
          </property>
                  
          <property name="maxPoolSize">
                      
          <value>3</alue>
                  
          </property>
                  
          <property name="testQuery">
                      
          <value>SELECT 1</alue>
                  
          </property>
              
          </bean>

              
          <bean id="lobHandler"
                  class
          ="org.springframework.jdbc.support.lob.DefaultLobHandler" />

              
          <!-- 業務數據庫的sqlMapClient -->
              
          <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
                  
          <property name="configLocation" value="classpath:SqlMapConfig.xml" />
                  
          <property name="dataSource" ref="dataSource" />
                  
          <property name="lobHandler" ref="lobHandler" />
              
          </bean>

              
          <!-- Construct Atomikos UserTransactionManager, needed to configure Spring -->
              
          <bean id="atomikosTransactionManager"
                  class
          ="com.atomikos.icatch.jta.UserTransactionManager"
                  init-method
          ="init" destroy-method="close">
                  
          <!--  when close is called, should we force transactions to terminate or not? -->
                  
          <property name="forceShutdown">
                      
          <value>true</alue>
                  
          </property>
              
          </bean>

              
          <!-- Also use Atomikos UserTransactionImp, needed to configure Spring  -->
              
          <bean id="atomikosUserTransaction"
                  class
          ="com.atomikos.icatch.jta.UserTransactionImp">
                  
          <property name="transactionTimeout" value="300" />
              
          </bean>

              
          <!-- Configure the Spring framework to use JTA transactions from Atomikos -->
              
          <bean id="transactionManager"
                  class
          ="org.springframework.transaction.jta.JtaTransactionManager">
                  
          <property name="transactionManager" ref="atomikosTransactionManager"/>
                  
          <property name="userTransaction" ref="atomikosUserTransaction"/>
              
          </bean>
              
              
          <tx:advice id="txAdvice" transaction-manager="transactionManager">
                  
          <tx:attributes>
                      
          <tx:method name="find*" propagation="REQUIRED" read-only="true" rollback-for="ServiceException"/>
                      
          <tx:method name="get*" propagation="REQUIRED" read-only="true" rollback-for="ServiceException"/>
                      
          <tx:method name="list*" propagation="REQUIRED" read-only="true" rollback-for="ServiceException"/>
                      
          <tx:method name="*" propagation="REQUIRED" rollback-for="ServiceException"/>
                  
          < :attributes>
              
          < :advice>

              
          <aop:config>
                  
          <aop:advisor pointcut="execution(* com.service.impl.*.*(..))" advice-ref="txAdvice" />
              
          </aop:config>
              
              
          <!-- JBPM集成配置 -->
              
          <bean id="sessionFactoryForJbpm"
                  class
          ="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                  
          <property name="mappingJarLocations">
                      
          <list>
                      
          <!-- hibernate 映射文件所在的jar包路徑 -->
                          
          <value>WEB-INF b/jbpm-jpdl.jar</alue>
                      
          < st>
                  
          </property>
                  
          <property name="hibernateProperties">
                      
          <props>
                          
          <prop key="hibernate.dialect">
                              org.hibernate.dialect.MySQL5Dialect
                          
          </prop>
                          
          <prop key="hibernate.show_sql">true</prop>
                          
          <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
                      
          </props>
                  
          </property>
                  
          <property name="dataSource" ref="dataSourceJbpm" />
              
          </bean>

              
          <bean id="jbpmConfiguration"
                  class
          ="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
                  
          <property name="sessionFactory" ref="sessionFactoryForJbpm" />
                  
          <!-- jbpm.cfg.xml 配置JBPM的參數,如郵件服務器地址等,保持默認即可-->
                  
          <property name="configuration" value="classpath:jbpm.cfg.xml" />
                  
          <property name="createSchema" value="false" />
              
          </bean>

              
          <bean id="jbpmTemplate"
                  class
          ="com.ideal.common.util.JbpmUtils">
                  
          <constructor-arg index="0" ref="jbpmConfiguration" />
              
          </bean>
              
          <!-- END OF JBPM集成配置 --> 

          posted on 2009-03-11 09:34 paulwong 閱讀(1273) 評論(0)  編輯  收藏 所屬分類: JBPM

          主站蜘蛛池模板: 富川| 潢川县| 重庆市| 武鸣县| 长岛县| 手游| 高青县| 龙海市| 柳林县| 泸定县| 大城县| 六安市| 涪陵区| 滦平县| 太仓市| 庆云县| 黄龙县| 北川| 策勒县| 宁陕县| 临澧县| 永州市| 深圳市| 禹城市| 多伦县| 图们市| 柏乡县| 阿克陶县| 盈江县| 固始县| 马公市| 潜江市| 长海县| 府谷县| 磴口县| 峨眉山市| 壶关县| 肥东县| 昭平县| 台东县| 同江市|