Atomikos Forum |
|
Hi all,
I've got a project where I'm trying to use Atomikos with various ORMs & DBs to compare function & performance. So far, I've tested Hibernate+Atomikos+Derby, which worked. Next, I'm trying to use DataNucleus+Atomikos+Derby, and I'm having trouble. First problem is dumb: AtomikosDataSourceBean#toString() throws depending on its state. That shouldn't be the case. You should be able to call toString() at **any** time and not have it throw on you. To get around that, I had to decrease DataNucleus.Connection logging to INFO (from DEBUG -- see http://www.datanucleus.org/products/accessplatform/logging.html). Second problem: the two products aren't working nicely together. All code, with reproducible test cases, is available at http://people.apache.org/~madams/examples/atomikos dn-atomikos.zip is a simple Maven project that's a plug-in point for DataNucleus that lets DataNucleus find the TransactionManager (similar to Atomikos's Hibernate integration). It needs to be built & installed to your local maven repo. (See http://www.datanucleus.org/extensions/jta_locator.html for more info on DataNucleus's JTA extension point.) Build & install it by extracting, changing to the archive's "trunk" directory & issuing the command "mvn clean install". db.jta.zip is a Maven project that uses Maven profiles along with Spring 3.1 profiles to activate different components during the test. DataNucleus is currently the default ORM profile. To run the tests that produce the errors, extract the archive and run "mvn clean test". To see Hibernate work successfully on the very same tests, run "mvn clean test -Dorm=hib -Ddb=derby -Djta=atomikos". Can anyone tell me why DataNucleus is failing to work with Atomikos? Thanks, Matthew
Burned a couple of days on this now. About to give up on Atomikos & try something else to see if it'll work.
Atomikos guys, can you please have a look? Latest code is at http://people.apache.org/~madams/examples/atomikos/ They're executable maven projects. Just extract & "mvn install" the latest dn-atomikos-*.zip, then extract & "mvn clean test" the latest db.jta-*.zip and you'll see the exceptions & test failures. Thanks, Matthew
Got it working. The primary issue is that when injecting an EntityManager from Spring via the @PersistenceContext annotation, you need to specify @PersistenceContext(type=PersistenceContextType.EXTENDED). It was difficult to identify due to the fact that Atomikos's AtomikosDataSourceBean#toString() (see default82df.html?82985_jc858bq999tqtfvk) was throwing on me and Spring's PersistenceAnnotationBeanPostProcessor has a bug in it (see https://jira.springsource.org/browse/SPR-8834).
HTH, Matthew |