Mohamed Abuthahir [
https://community.jboss.org/people/abuinigate] created the discussion
"Usage of ksession in Jbpm Spring Implementation"
To view the discussion, visit:
https://community.jboss.org/message/784268#784268
--------------------------------------------------------------
Hi,
I am developing a web application which I will invoke a jbpm workflow. I am following a
*spring-jbpm* integeration pattern to create a *kbase,ksession* etc.My question is how we
have to use the *ksession*? Means for each request I have to create a seperate
session(every process instance has unique session id ) or multiple process instances
sharing the same *ksession.*
Currently I am following a spring approach in which one session id shared between multiple
process instances. How to change this behaviour to make it one session per process
instance.Is there any way to do this in spring. I tried bean scope"prototype"
which will not workout. and jbpm session tag not having the attribute scope.
My XML is:
<jbpm:kbase id="kbase">
<jbpm:resources>
<jbpm:resource type="BPMN2" source="classpath:Hello.bpmn"
/>
</jbpm:resources>
</jbpm:kbase>
<jbpm:ksession id="ksession" type="stateful"
kbase="kbase">
<jbpm:configuration>
<jbpm:jpa-persistence>
<jbpm:entity-manager-factory ref="entityManagerFactory"/>
<jbpm:transaction-manager ref="transactionManager"/>
</jbpm:jpa-persistence>
</jbpm:configuration>
</jbpm:ksession>
<bean id="ds"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver"></property>
<property name="url"
value="jdbc:mysql://localhost:3306/jbpmworkflow?autoReconnect=true"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="ds">
<property name="persistenceXmlLocation"
value="classpath:META-INF/persistence.xml" />
<property name="persistenceUnitName"
value="org.jbpm.persistence.jpa" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="MYSQL"/>
<property name="showSql" value="true"/>
<property name="databasePlatform"
value="org.hibernate.dialect.MySQL5Dialect" />
</bean>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager"
p:entityManagerFactory-ref="entityManagerFactory">
<property name="dataSource" ref="ds"/>
</bean>
Waiting eagerly for your replies.
--Abuthahir
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/784268#784268]
Start a new discussion in jBPM Development at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]