Note that there are some explanatory texts on larger screens.

plurals
  1. POjBPM + Spring transactions sharing and scope
    text
    copied!<p>I've inherited an app using jBPM and Spring and am trying to figure out if it is configured the way it should be.</p> <p>First question: Does jBPM span a single JTA (JDBC and/or Hibernate) transaction across multiple actions in the same transition by default? If not, can it be configured to? So in the example below is there a way to span a transaction across Action1 and Action2.</p> <p>jBPM actions in this project retrieve services or DAOs (JDBC) from Spring context. For the configuration described below, are jBPM actions and the service / DAO methods they invoke encapsulated in one transaction? DAO and service methods are annotated with @Transactional themselves.</p> <p>State definition:</p> <pre><code>&lt;state name="SomeState"&gt; &lt;event type="node-enter"&gt; &lt;action class="SomeAction"/&gt; &lt;/event&gt; &lt;transition name="transition1" to="finish"&gt; &lt;action class="Action1"/&gt; &lt;action class="Action2"/&gt; &lt;/transition&gt; &lt;transition name="transition.stop" to="finish"/&gt; &lt;/state&gt; </code></pre> <p>My jBPM config:</p> <pre><code>&lt;jbpm-configuration&gt; &lt;jbpm-context&gt; &lt;!--&lt;service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" /&gt;--&gt; &lt;service name="persistence"&gt; &lt;factory&gt; &lt;bean class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory"&gt; &lt;field name="isTransactionEnabled"&gt; &lt;false /&gt; &lt;/field&gt; &lt;/bean&gt; &lt;/factory&gt; &lt;/service&gt; &lt;service name="tx" factory="org.jbpm.tx.TxServiceFactory" /&gt; &lt;service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" /&gt; &lt;service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" /&gt; &lt;service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" /&gt; &lt;service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" /&gt; &lt;/jbpm-context&gt; &lt;!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory --&gt; &lt;string name="resource.hibernate.cfg.xml" value="hibernate.jbpm.cfg.xml" /&gt; &lt;!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar --&gt; &lt;string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" /&gt; &lt;string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" /&gt; &lt;string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" /&gt; &lt;string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" /&gt; &lt;string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" /&gt; &lt;string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" /&gt; &lt;string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" /&gt; &lt;string name="resource.mail.templates" value="jbpm.mail.templates.xml" /&gt; &lt;int name="jbpm.byte.block.size" value="1024" singleton="true" /&gt; &lt;bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl" singleton="true" /&gt; &lt;bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" /&gt; &lt;string name="jbpm.mail.smtp.host" value="localhost" /&gt; &lt;bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" /&gt; &lt;string name="jbpm.mail.from.address" value="jbpm@noreply" /&gt; &lt;bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor"&gt; &lt;field name="jbpmConfiguration"&gt;&lt;ref bean="jbpmConfiguration" /&gt;&lt;/field&gt; &lt;field name="name"&gt;&lt;string value="JbpmJobExecutor" /&gt;&lt;/field&gt; &lt;field name="nbrOfThreads"&gt;&lt;int value="1" /&gt;&lt;/field&gt; &lt;field name="idleInterval"&gt;&lt;int value="5000" /&gt;&lt;/field&gt; &lt;field name="maxIdleInterval"&gt;&lt;int value="3600000" /&gt;&lt;/field&gt; &lt;!-- 1 hour --&gt; &lt;field name="historyMaxSize"&gt;&lt;int value="20" /&gt;&lt;/field&gt; &lt;field name="maxLockTime"&gt;&lt;int value="600000" /&gt;&lt;/field&gt; &lt;!-- 10 minutes --&gt; &lt;field name="lockMonitorInterval"&gt;&lt;int value="60000" /&gt;&lt;/field&gt; &lt;!-- 1 minute --&gt; &lt;field name="lockBufferTime"&gt;&lt;int value="5000" /&gt;&lt;/field&gt; &lt;!-- 5 seconds --&gt; &lt;/bean&gt; &lt;/jbpm-configuration&gt; </code></pre> <p>Relevant spring config:</p> <pre><code>&lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; &lt;bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/&gt; &lt;bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor"&gt; &lt;property name="transactionInterceptor" ref="txInterceptor"/&gt; &lt;/bean&gt; &lt;bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"&gt; &lt;property name="transactionManager" ref="transactionManager"/&gt; &lt;property name="transactionAttributeSource"&gt; &lt;bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload