Atomikos Forum |
|
Hey,
I'm trying to build an integration between Atomikos, Berkeley DB Java edition using spring framework. So far, I've gotten the Atomikos to spawn a transaction when invoking tests, as well as commit/rollback depending on exceptions thrown in the method body. Now, BDB is not an SQL store, so I can't register it as a datasource for TM. It simply provides an XAEnvironment (which implements XAResource). Judging by the docs, there's quite a lot of boilerplate code to use it within an external TM (http://www.oracle.com/technetwork/database/berkeleydb/je-faq-096044.html#JE2.0hassupportforXAtransactionsinaJ2EEappserverenvironment.CanIuseXAtransactions2phasecommitinanon-J2EEenvironment) This kind of renders the beauty of @Transactional spring methods unusable. What would be the proper way to integrate those 3? Any hints or ideas would be greatly appreciated. I've created a sample project which illustrates the problem,it can be checked out anonymously if needed: https://bitbucket.org/phuqit/berkeley-java-maven/src regards, Andrius Juozapaitis
My first guess would be: before you access the DB, just make sure to enlist the XAEnvironment as part of the JTA transaction (if any). At least that should take care of the boilerplate code in the berkeley docs.
Not sure if something more sophisticated is possible. For JDBC and JMS, our connectors take care of all this behind the scenes. A similar approach for Berkeley DB would suggest a "decorator" for Berkeley in the same way our DataSource is a decorator for vendor-specific implementations, adding the XA stuff. Not sure if that helps, but it's the only thing I can think of right now... Let me know if that works - I'd be curious to see how your integration evolves. |