Announcement Announcement Module
No announcement yet.
JdoTransactionManager vs JtaTransactionManager Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JdoTransactionManager vs JtaTransactionManager


    I am currently developing a JDO-based app for JBoss.

    I am a bit puzzled by the fact that there exist a Jdo- and a JtaTransactionManager.
    Indeed, both 'concepts' (JDO and JTA) are orthogonal: you can use JDO and JTA at the same time. Actually, that is what I do.

    I wonder which TransactionManager I should use in my J2EE app.

    I have first tried with JdoTransactionManager, but it did not work (complaints about non-transactional operations).

    I then switched to a JtaTransactionManager, and now it works quite fine, but each DAO creates its own PersistenceManager. This is a bad for performance.

    I would be grateful if someone could shed some light on this.



  • #2
    All the local transaction managers, whether JdoTransactionManager, TopLinkTransactionManager, DataSourceTransactionManager or HibernateTransactionManager, are designed to work with a single database, and against the target API and JDBC.

    The major plus: they're simple to configure (outside Spring, that is, Spring configuration is similar in all cases). In this case, you don't need JTA and should not use a JTA datasource. Another plus: your app will run just fine on Tomcat or another servlet container, if you don't need other capabilities of the app server.

    If you use JtaTransactionManager, Spring will use JTA under the covers. You should use a JTA datasource (app server connection pool) and ensure that all your resources are enlistable in global transactions.

    My guess is that you need to use the JCA connector for your JDO product if you want to use JtaTransactionManager.


    • #3
      Thanks a lot for clarifications.

      It works well from a transactional point of view with JtaTransactionManager.

      The problem is that if a business service calls five DAOs, they all create their own PersistenceManager. It is needless and bad for performances.

      It seems that my DAOs don't use the thread-bound PersistenceManager. This is weird as

      - DAOs inherit from JdoDaoSupport.
      - I use TransactionAwarePersistenceManagerFactoryProxy that normally should bound it

      I will investigate further, but I would appreciate any help in the meantime.