
Originally Posted by
jbakerc
Thanks. I was just reading upon Atomikos.
Does anyone know of a good guide covering linking JMS and JPA within Atomikos, that would cover something like this in Spring:
Code:
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<bean id="remoteDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
...
</bean>
<bean id="remoteJPAAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:database="..."
p:showSql="..."/>
<bean id="remotePersistenceUnitManager" class="org.springframework.data.jpa.support.MergingPersistenceUnitManager">
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/*/persistence.xml</value>
</list>
</property>
<property name="dataSources">
<map>
<!-- keyed from persistence.xml -->
<entry key="remoteDS" value-ref="remoteDataSource"/>
</map>
</property>
<!-- if no datasource is specified, use this one -->
<property name="defaultDataSource" ref="remoteDataSource"/>
</bean>
<bean id="remoteEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:jpaVendorAdapter-ref="remoteJPAAdapter">
<property name="persistenceUnitManager" ref="remotePersistenceUnitManager"/>
</bean>
<bean id="remoteTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="remoteEntityManagerFactory" />
</bean>
I've tried and it runs but Hibernate is pushing a row into the database when the persist method on the entity manager is called, as if XA wasn't in use at all - at least it used to do this after the @Transactional annotated method completed.