I have several data sources and one database with JPA. I am using websphere 7. I want all these datasouces to be configured as global transactions. I am using below spring configurations, but transactions do not work as expected global transaction. If one db fails, then the other db receives a fee that is not expected as a single global transaction. Can you help me where I'm doing the wrong ones
I have 2 datasouce one as below with id = "us_icfs_datasource" and the other using JPA
<jee:jndi-lookup id="entityManagerFactory" jndi-name="persistence/persistenceUnit"/> <bean id="pabpp" class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" /> <tx:annotation-driven/> <jee:jndi-lookup id="US_ICFS_DATASORCE" jndi-name="jdbc/financing_tools_docgen_txtmgr" cache="true" resource-ref="true" proxy-interface="javax.sql.DataSource" />
I also added the code below in web.xml
<persistence-unit-ref> <persistence-unit-ref-name>persistence/persistenceUnit</persistence-unit-ref-name> <persistence-unit-name>persistenceUnit</persistence-unit-name> </persistence-unit-ref> <persistence-context-ref> <persistence-context-ref-name>persistence/persistenceUnit</persistence-context-ref-name> <persistence-unit-name>persistenceUnit</persistence-unit-name> </persistence-context-ref>
below is my code where i m uses a transaction
> @Transactional public TemplateMapping addTemplateMapping(User user, > TemplateMapping templateMapping) throws > TemplateMappingServiceException { .... }
source share