6

The best effort 1PC is nicely described in this post. The author, David Syer, who works for SpringSource, provided an implementation of a ChainedTransactionManager extending the Spring AbstractPlatformTransactionManager class.

This particular transaction manager can start n transactions, e.g., JDBC or JMS sessions, and perform commit/rollback using n instances of AbstractPlatformTransactionManager, one per resource. This is very useful where XA drivers are not available. Since the post is very old, the code works fine with Spring 2.5, but it fails with Spring 3+.

There is a request ticket to implement a similar feature in Spring 3+. I'm willing to give it a try but I thought I'd ask first: are there any implementations out there?

Thanks

Giovanni Botta
  • 9,626
  • 5
  • 51
  • 94
  • 1
    I think you can try using the ChainedTransactionManager from spring-data-neo4j, but what kind of database nowadays does not provide an xa driver? If you need another idea, this blog http://infinispan.blogspot.com.ar/2011/06/faster-infinispan-based-second-level.html show how a cache system hooks to JTA synchronization, to avoid XA, in terms of performance. – Luciano Apr 04 '13 at 19:01
  • Thanks I am using that now, someone suggested it on Spring's Jira. And for example Vectorwise doesn't provide an XA driver. Giovanni – Giovanni Botta Apr 04 '13 at 21:00
  • Hi Giovanni, we are also trying to do a similar setup for our spring batch application using best effort 1PC pattern. Can you please let us know your experience in using this approach. If you can provide us a sample configuration file for reference it would be greatly helpful. my email id is ravikiran763@gmail.com . Thank you in advance – Ravikiran butti Apr 20 '15 at 10:24
  • @rave763 I am no longer working on this project and don't have access to the code anymore but I had good luck with `ChainedTransactionManager` back then. My config was mostly custom, i.e., not your standard Spring config. I never liked the XML config approach anyway. – Giovanni Botta Apr 21 '15 at 15:15

1 Answers1

4

As suggested by Luciano, I found a perfectly working implementation of ChainedTransactionManager in:

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-neo4j-tx</artifactId>
  <version>2.2.0.RELEASE</version>
</dependency>

class name: org.springframework.data.neo4j.transaction.ChainedTransactionManager

EDIT:

The ChainedTransactionManager is now part of Spring Data Commons as of version 1.6.1.

Giovanni Botta
  • 9,626
  • 5
  • 51
  • 94