My Spring Application integration with Alfresco Activity workflow - spring

I have developed web application with spring framework and PostgreSQL,
In my application there is requirement of workflow.
For my application database is different.
I want to integrate Alfresco Activity workflow in may application,
Could any body give how can I integrate Alfresco Activity workflow in may web application?

You may integrate alfresco activity in this way:
maven dependency:
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti-version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>${activiti-version}</version>
</dependency>
spring configuration file like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
<bean id="activitiTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="activitiEngineDataSource" />
</bean>
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="activitiEngineDataSource" />
<property name="transactionManager" ref="activitiTransactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="deploymentResources" value="classpath:/bpm/*.bpmn20.xml"/>
<property name="history" value="full" />
<property name="jobExecutorActivate" value="false" />
<property name="mailServerUsername" value="valerio.vaudi#localhost"/>
<property name="mailServerPassword" value="pass"/>
<property name="mailServerHost" value="localhost"/>
<property name="mailServerPort" value="25"/>
<property name="mailServerUseTLS" value="true"/>
</bean>
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
<bean id="formService" factory-bean="processEngine" factory-method="getFormService"/>
<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" />
<bean id="itentitiService" factory-bean="processEngine" factory-method="getIdentityService" />
<jdbc:embedded-database id="activitiEngineDataSource" type="H2">
<jdbc:script location="classpath:org/activiti/db/create/activiti.h2.create.engine.sql" />
<jdbc:script location="classpath:org/activiti/db/create/activiti.h2.create.history.sql" />
<jdbc:script location="classpath:org/activiti/db/create/activiti.h2.create.identity.sql" />
</jdbc:embedded-database>
</beans>
use activity eclipse plug-in for editing your bpmn2.0 file
and use the api for use the engine.
how use the api I can suggest to read Activity in action.
I Hope that this can help you

Related

How can I connect to two different databases, one for reading and one for writing in the same application using Spring?

Use Case: I am running a spring application which has orders. I can create plans for these orders. My dev environment/db does not have any orders and they come from a different application (we share the same db). So, Is there a way I can read orders from production database but when I create a plan, it gets saved to dev database?
My persistence.xml is as below
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="Demo_PU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.entity.ErrorMessage</class>
<class>com.entity.ErrorMessageTxt</class>
<class>com.entity.ErrorMessageTxtId</class>
<class>com.entity.Language</class>
<class>com.entity.TextEntity</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.InformixDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.id.new_generator_mappings" value="true" />
<property name="hibernate.cache.region.factory_class"
value="net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory" />
<property name="hibernate.cache.use_second_level_cache"
value="true" />
<property name="hibernate.cache.use_query_cache" value="true" />
<property name="hibernate.generate_statistics" value="false" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.connection.characterEncoding"
value="UTF-8" />
<!-- Adding timeouts for Lock Mode and Query -->
<property name="javax.persistence.query.timeout" value="60000" />
<property name="javax.persistence.lock.timeout" value="60000" />
</properties>
</persistence-unit>
</persistence>
My spring-config.xml is as below
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<context:component-scan base-package="com.project"/>
<context:component-scan base-package="com.project2"/>
<task:annotation-driven executor="myExecutor" scheduler="myScheduler"/>
<task:executor id="myExecutor"/>
<task:scheduler id="myScheduler"/>
<bean id="qa-informix" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/dcSysCommon"/>
</bean>
<bean id="pum" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/persistence.xml</value>
</list>
</property>
<property name="dataSources">
<map>
<entry key="localDataSource" value-ref="qa-informix" />
</map>
</property>
<property name="defaultDataSource" ref="qa-informix"/>
</bean>
<bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitManager" ref="pum" />
<property name="jpaDialect">
<bean class="com.project.utils.IsolationSupportHibernateJpaDialect"/>
</property>
<property name="persistenceUnitName" value="PYD_PU" />
</bean>
<!-- bean post-processor for JPA annotations -->
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<!-- this enables the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="emf" />
</bean>
<bean id="interpolator" class="org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator" />
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="messageInterpolator" ref="interpolator" />
</bean>
<bean class="com.project3.common.core.bo.LanguageBusinessObject" primary="true" />
<bean name="restUtils" class="com.project1.utils.RestUtils" />
<bean id="srvPropertyFile" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="srvPropertyFile" />
</bean>
<bean id="beanConfig" class="io.swagger.jaxrs.config.BeanConfig">
<property name="title" value="Swagger UI for QAS"/>
<property name="version" value="1.0.0" />
<property name="schemes" value="http" />
<property name="host" value="#{srvPropertyFile.hostName}:#{srvPropertyFile.pydPort}" />
<property name="basePath" value="planyourday/#{srvPropertyFile.countryCode}/#{srvPropertyFile.dcNumber}"/>
<property name="resourcePackage" value="com.project1.resources"/>
<property name="license" value="Apache 2.0 License"/>
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
<property name="scan" value="true"/>
</bean>
<bean id="apiListingResource" class="com.project1.utils.SwaggerApiListingResource"/>
<bean id="swaggerSerializers" class="io.swagger.jaxrs.listing.SwaggerSerializers" scope="singleton"/>
</beans>
In my Jetty server config, I am defining the srvPropertyFile which references to the environment.properties file which has the database connection to dev db.
How should I manage my persistence context so that the entity manager used while reading orders and the entity manager used while creating plans connects to different databases?
you have to configure two persistence unit, data source and transaction manager(one for read and other for write) each.
While using entity manager specify the persistence unit like below.
PersistenceUnit(unitName = "x")
EntityManagerFactory entityManagerFactory;

JobRepositoryFactoryBean error spring batch

I started to learn spring batch and I have a problem that when i want to
persist the state of the job in a database using JobRepositoryFactoryBean.
compiler displays :
"Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [springConfig.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/core/simple/ParameterizedRowMapper"
but not error when i use MapJobRepositoryFactoryBean
I'm using spring 5
springconfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
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-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<context:component-scan base-package="springbatch" />
<context:annotation-config />
<bean id="personneReaderCSV" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" value="input/personnes.txt" />
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<property name="lineTokenizer">
<bean
class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<property name="delimiter" value="," />
<property name="names" value="id,nom,prenom,civilite" />
</bean>
</property>
<property name="fieldSetMapper">
<bean
class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper">
<property name="targetType" value="springbatch.entities.Personne" />
</bean>
</property>
</bean>
</property>
</bean>
<bean id="jobLauncher"
class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean name="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/spring_test" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>springbatch.entities.Personne</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>
<job id="importPersonnes" xmlns="http://www.springframework.org/schema/batch">
<step id="readWritePersonne">
<tasklet>
<chunk reader="personneReaderCSV"
processor="personProcessor"
writer="personWriter"
commit-interval="2" />
</tasklet>
</step>
</job>
<bean id="daoPersonne" class="springbatch.dao.PersonneDaoImp">
<property name="factory" ref="sessionFactory"></property>
</bean>
<bean id="personWriter" class="springbatch.batch.PersonneWriter">
<property name="dao" ref="daoPersonne"></property>
</bean>
<bean id="personProcessor" class="springbatch.batch.PersonneProcess">
</bean>
<bean id="batchLauncher" class="springbatch.MyBean">
</bean>
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseType" value="Mysql" />
</bean>
<task:scheduled-tasks>
<task:scheduled ref="batchLauncher" method="message"
cron=" 59 * * * * * " />
</task:scheduled-tasks>
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="org/springframework/batch/core/schema-drop-mysql.sql" />
<jdbc:script location="org/springframework/batch/core/schema-mysql.sql" />
</jdbc:initialize-database>
</beans>
but not error when i use :
<bean id="jobRepository"
class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
<property name="transactionManager" ref="transactionManager" />
</bean>
You are using Spring Batch v2.2 with Spring Framework 5. That's not going to work properly as ParameterizedRowMapper has been removed in Spring Framework 4.2+ (hence the exception).
I recommend that you use Spring Batch v4.1 (since v2.x is not maintained anymore) and your issue should be fixed.
The best way to manage Spring dependencies is to let Spring Boot do it for you either by generating a project from start.spring.io or by using the Spring Boot BOM. With both ways, you will have the correct Spring projects dependencies that are known to work well together.

JMS Message consumed despite transaction rollback

I have a simple XA test setup, using JMS and JDBC. I use Atomikos 3.9.3, ActiveMQ 5.10.1 and DB2, with their proper XA drivers.
Sending messaged works ok, it is transactional. But the consume case does not - despite throwing an exception, the JMS message is consumed.
The strange thing is that it seems to be timing related - usually the first time the transaction is rolled back, and the message is still there - but one of the subsequent attempts to consume the message from the queue is successful.
This is my spring configuration for consuming messages:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jms="http://www.springframework.org/schema/jms"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd">
<bean id="xaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
<constructor-arg value="mulejms" />
<constructor-arg value="mulejms" />
<constructor-arg value="tcp://localhost:61616" />
</bean>
<bean id="atomikosConnectionFactoryBean" class="com.atomikos.jms.AtomikosConnectionFactoryBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="amq1" />
<property name="xaConnectionFactory" ref="xaConnectionFactory" />
</bean>
<bean id="msgHandler" class="com.findonnet.messaging.MessageHandlerImpl">
<property name="sequenceDAO" ref="sequenceDAO" />
</bean>
<!-- End Messaging related beans -->
<bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="DB2" />
<property name="xaDataSource" ref="db2DataSource" />
</bean>
<bean id="db2DataSource" class="com.ibm.db2.jcc.DB2XADataSource">
<property name="serverName" value="localhost" />
<property name="portNumber" value="50000" />
<property name="databaseName" value="HWEXT" />
<property name="driverType" value="4" />
<property name="user" value="hwextdev" />
<property name="password" value="hwextdev" />
</bean>
<!-- ===================================================== -->
<!-- ==== TRANSACTION MANAGER CONFIG ===================== -->
<!-- ===================================================== -->
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<property name="forceShutdown" value="true" />
</bean>
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp" />
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikosTransactionManager" />
<property name="userTransaction" ref="atomikosUserTransaction" />
</bean>
<!-- enable transaction annotations, and use the correct transaction manager! -->
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="sequenceDAO" class="com.findonnet.persistence.MessageSequenceDAO">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- ========================================= -->
<!-- ==== JMS CONFIG FOR SPRING=============== -->
<!-- ========================================= -->
<jms:annotation-driven container-factory="listenerContainer" />
<jms:listener-container connection-factory="atomikosConnectionFactoryBean"
transaction-manager="transactionManager" concurrency="1"
factory-id="listenerContainer" />
</beans>
I have #Transactional and #JmsListener(destination = "test.q1") annotations on my MessageHandlerImpl.handleOrder() method.
I have no idea what I'm doing wrong.
Turns out everything was working fine, the messages ended up in the dead letter queue. I feel stupid now.

How to add google OAuth(spring-social-google) to the existing spring project using spring-social?

I developed spring application with oauth authentication using spring social project. I'm currently able to authenticate using facebook, twitter and linkedin. I would like to also add google authentication using spring-social-google. Its really confusing for me where to add google's connection factory in the existing spring social configuration.
My current spring social application context is
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:facebook="http://www.springframework.org/schema/social/facebook"
xmlns:twitter="http://www.springframework.org/schema/social/twitter"
xmlns:social="http://www.springframework.org/schema/social"
xmlns:linkedin="http://www.springframework.org/schema/social/linkedin"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/social/facebook http://www.springframework.org/schema/social/spring-social-facebook.xsd
http://www.springframework.org/schema/social/linkedin http://www.springframework.org/schema/social/spring-social-linkedin.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/social/twitter http://www.springframework.org/schema/social/spring-social-twitter.xsd
http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:property-placeholder location="/WEB-INF/properties/application.properties" />
<facebook:config app-id="${facebook.clientId}" app-secret="${facebook.clientSecret}" app-namespace="my-app" />
<twitter:config app-id="${twitter.consumerKey}" app-secret="${twitter.consumerSecret}"/>
<linkedin:config app-id="${linkedin.consumerKey}" app-secret="${linkedin.consumerSecret}"/>
<social:jdbc-connection-repository/>
<bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource" />
<bean id="connectController" class="org.springframework.social.connect.web.ConnectController" autowire="constructor">
<property name="connectInterceptors">
<list>
<bean class="com.prs.ony.controller.facebook.PostToWallAfterConnectInterceptor" />
<bean class="com.prs.ony.controller.twitter.TweetAfterConnectInterceptor" />
</list>
</property>
</bean>
<bean id="psc" class="org.springframework.social.connect.web.ProviderSignInController" autowire="constructor" />
<bean id="signInAdapter" class="com.prs.ony.controller.signin.SimpleSignInAdapter" autowire="constructor" />
<!-- <bean id="disconnectController" class="org.springframework.social.facebook.web.DisconnectController"
c:_0-ref="usersConnectionRepository" c:_1="${facebook.clientSecret}" /> -->
</beans>
Now im confused where to add the googles connection factory. It has to work along with the existing there oauth providers.
<bean id="connectionFactoryLocator" class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
<property name="connectionFactories">
<list>
<bean class="org.springframework.social.google.connect.GoogleConnectionFactory">
<constructor-arg value="${google.consumerKey}" />
<constructor-arg value="${google.consumerSecret}" />
</bean>
</list>
</property>
</bean>
Any help would be highly appreciated.
It is possible to omit the usage of the concrete social configuration namespace and register connection factories all together:
<bean id="connectionFactoryLocator" class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
<property name="connectionFactories">
<list>
<bean class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
<constructor-arg name="appId" value="${facebook.clientId}" />
<constructor-arg name="appSecret" value="${facebook.clientSecret}" />
</bean>
<bean class="org.springframework.social.twitter.connect.TwitterConnectionFactory">
<constructor-arg name="consumerKey" value="${twitter.consumerKey}" />
<constructor-arg name="consumerSecret" value="${twitter.consumerSecret}" />
</bean>
<bean class="org.springframework.social.linkedin.connect.LinkedInConnectionFactory">
<constructor-arg name="consumerKey" value="${linkedin.consumerKey}" />
<constructor-arg name="consumerSecret" value="${linkedin.consumerSecret}" />
</bean>
<bean class="org.springframework.social.google.connect.GoogleConnectionFactory">
<constructor-arg name="clientId" value="${google.consumerKey}" />
<constructor-arg name="clientSecret" value="${google.consumerSecret}" />
</bean>
</list>
</property>
</bean>

where to use bean springTaskSessionFactory in JBPM process execution?

i got an example of spring configuration with jbpm here http://docs.jboss.org/drools/release/5.4.0.Final/droolsjbpm-integration-docs/html/ch.spring.html and i have implemented it.There is a bean called springTaskSessionFactory ,i don't get where this bean will be used in human task execution ?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbpm="http://drools.org/schema/drools-spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://drools.org/schema/drools-spring org/drools/container/spring/drools-spring-1.2.0.xsd">
<!-- persistence & transactions-->
<bean id="htEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="org.jbpm.task" />
</bean>
<bean id="htEm" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="htEmf"/>
</bean>
<bean id="jpaTxMgr" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="htEmf" />
<!-- this must be true if using the SharedEntityManagerBean, and false otherwise -->
<property name="nestedTransactionAllowed" value="true"/>
</bean>
<bean id="htTxMgr" class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager">
<constructor-arg ref="jpaTxMgr" />
</bean>
<!-- human-task beans -->
<bean id="systemEventListener" class="org.drools.SystemEventListenerFactory" factory-method="getSystemEventListener" />
<bean id="taskService" class="org.jbpm.task.service.TaskService" >
<property name="systemEventListener" ref="systemEventListener" />
</bean>
<bean id="springTaskSessionFactory" class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl"
init-method="initialize" depends-on="taskService" >
<!-- if using the SharedEntityManagerBean, make sure to enable nested transactions -->
<property name="entityManager" ref="htEm" />
<property name="transactionManager" ref="htTxMgr" />
<property name="useJTA" value="false" />
<property name="taskService" ref="taskService" />
</bean>
</beans>

Resources