2013-08-20 2 views
0

Activiti 용 공통 트랜잭션 관리자 & 최대 절전 모드를 사용하려고합니다. 그들은 공통의 DB를 가지고있다. 나는 Activiti의 도움으로 먼저 최대 절전 모드의 도움으로 다음 동일한 개체를 저장하려고 :Activiti + 최대 절전 모드 : 공통 트랜잭션 관리자

Session session = ((SessionFactory) applicationContext.getBean("sessionFactory")).openSession(); 
session.beginTransaction(); 

session.save(client); 
execution.setVariable("client", client); 

session.getTransaction().commit(); 
session.close(); 

문제 : activiti의 ACT_RU_VARIABLE 테이블에 클라이언트 엔티티에 대한 기록을 볼 수 없습니다

.

질문 :

어떻게 Activiti 최대 절전 모드와 같은 트랜잭션을 사용하는지 확인하기 위해?

ADDITION :

applicationContext.xml

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> 
    <!-- Configuration --> 
    <context:property-placeholder location="classpath*:*.properties" /> 

    <!-- Annotation based configuration --> 
    <context:annotation-config /> 
    <context:component-scan base-package="name.krestjaninoff" /> 


    <!-- Data --> 
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
     <property name="driverClassName" value="org.postgresql.Driver"/> 
     <property name="url" value="jdbc:postgresql://localhost:5432/activiti-transaction-demo"/> 
     <property name="username" value="postgres"/> 
     <property name="password" value="password"/> 
    </bean> 
    <!-- 
     Activiti 
    --> 
    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> 
     <property name="databaseType" value="postgres" /> 
     <property name="dataSource" ref="dataSource" /> 
     <property name="transactionManager" ref="transactionManager" /> 
     <!--<property name="databaseSchemaUpdate" value="create" />--> 
     <property name="databaseSchemaUpdate" value="true" /> 
     <property name="history" value="audit" /> 
     <property name="jobExecutorActivate" value="false" /> 
     <property name="deploymentResources" value="classpath*:/process/*.bpmn20.xml" /> 
    </bean> 

    <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"> 
     <property name="processEngineConfiguration" ref="processEngineConfiguration" /> 
    </bean> 

    <bean id="repositoryService" factory-bean="processEngine" 
     factory-method="getRepositoryService" /> 
    <bean id="runtimeService" factory-bean="processEngine" 
     factory-method="getRuntimeService" /> 
    <bean id="taskService" factory-bean="processEngine" 
     factory-method="getTaskService" /> 
    <bean id="historyService" factory-bean="processEngine" 
     factory-method="getHistoryService" /> 
    <bean id="managementService" factory-bean="processEngine" 
     factory-method="getManagementService" /> 

    <!-- 
     Hibernate 
    --> 
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" scope="singleton"> 
     <property name="dataSource" ref="dataSource"/> 
     <property name="packagesToScan"> 
      <list> 
       <value>name.krestjaninoff.activiti.hello.db</value> 
      </list> 
     </property> 
     <property name="hibernateProperties"> 
      <props> 
       <prop key="hibernate.show_sql">true</prop> 
       <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQL82Dialect</prop> 
       <!--<prop key="hibernate.hbm2ddl.auto">create-drop</prop>--> 
      </props> 
     </property> 
    </bean> 

    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" scope="singleton"> 
     <property name="sessionFactory" ref="sessionFactory"/> 
     <property name="dataSource" ref="dataSource"/> 
    </bean> 
</beans> 
+0

Activiti 문서 http://www.activiti.org/userguide/#N12127에 따라 프로세스 변수로 엔터티를 추가하려면 JPA 주석을 사용하여 엔터티를 구성해야하며 processEngine에는 EntityManagerFactory에 대한 참조가 있어야합니다. 엔터티가 ACT_RU_VARIABLE 테이블에 삽입되지 않는 이유가 여기에있을 수 있습니다. – ATMTA

답변

0

대답은 간단하다 : 프로세스 변수는 프로세스가 대기 stait, 완성 또는 미사일 비동기 작업에 도달 할 경우에만 dB로 플러시. 그리고 ACT_RU_VARIABLE 테이블은 프로세스가 끝난 후에 정리됩니다. 따라서 ACT_RU_VARIABLE 테이블의 레코드를 보려면 UserTask 중에 체크해야합니다.

관련 문제