JBoss Community

Missing history data

created by urho in jBPM - View the full discussion

Hi,

 

Problem is that jbpm history information is not stored to database when using Spring configuration and Spring managed transactions. I'm using jbpm 4.4 and Spring 3

 

When I import jbpm.default.cfg.xml configuration on top of my own configuration, then the history data is stored, but I think this overrides the <transaction-context> or something and therefore it creates new transaction for jbpm code insted of reusing existing one.

Below is the configurations that I use:

 

My jbpm.cfg.xml:


<jbpm-configuration xmlns="http://jbpm.org/xsd/cfg">

      <!--import resource="jbpm.default.cfg.xml" /-->
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<!--import resource="jbpm.jobexecutor.cfg.xml" /-->
<import resource="jbpm.businesscalendar.cfg.xml" />

<process-engine-context>
<repository-service />
<repository-cache />
<execution-service />
<history-service />
<management-service />
<identity-service />
<task-service />


<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
<spring-transaction-interceptor policy="requiresNew"/>
</command-service>

<command-service name="txRequiredCommandService">
<retry-interceptor />
<environment-interceptor />
<spring-transaction-interceptor />
</command-service>


<object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
<field name="commandService">
<ref object="txRequiredCommandService" />
</field>
</object>

<object class="org.jbpm.pvm.internal.id.DatabaseIdComposer"
init="eager">
</object>

<!-- Added spring as read-context -->
<script-manager default-expression-language="juel"
default-script-language="juel"
read-contexts="execution, environment, process-engine, spring"
write-context="">
<script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>

<authentication />

<id-generator />

<types resource="jbpm.variable.types.xml" />
<address-resolver />
</process-engine-context>

<transaction-context>
<transaction type="spring" />
<repository-session />
<db-session />

<message-session />
<timer-session />
<history-session>
<object class="org.jbpm.pvm.internal.history.HistorySessionImpl" />
</history-session>

<!--
Need to set explicitly that we don't want jbpm to create sessions
-->
<hibernate-session current="true" close="false" />
</transaction-context>
</jbpm-configuration>

 

 

 

My spring xml (part of it):


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="mappingLocations">
<list>
<value>classpath:jbpm.execution.hbm.xml</value>
<value>classpath:jbpm.repository.hbm.xml</value>
<value>classpath:jbpm.task.hbm.xml</value>
<value>classpath:jbpm.history.hbm.xml</value>
<value>classpath:jbpm.identity.hbm.xml</value>
</list>
</property>

<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.query.substitutions">true=1 false=0</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.use_sql_comments">false</prop>
<prop key="hibernate.jdbc.batch_size">0</prop>
<!--prop key=hibernate.hbm2ddl.auto>update</prop-->
</props>
</property>

<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>

<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="${db.url}" />
<property name="username" value="${db.username}" />
<property name="password" value="${db.password}" />
</bean>

<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.processengine.SpringHelper">
<property name="jbpmCfg" value="jbpm.cfg.xml"/>
</bean>

<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="createProcessEngine"/>

 

Reply to this message by going to Community

Start a new discussion in jBPM at Community