Announcement Announcement Module
No announcement yet.
Clarification on Transaction Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clarification on Transaction

    Hi all

    Im in the middle of setting up the transaction hadling in my Spring based application. I just realised I need some clarification regarding transaction issues using Spring.

    In my app I have a Hibernate connection, which I distribute to the application through a SessionFactory. I then use the getCurrentSession() method inside my DAO objects. I have defined a number of commands that uses different DAO invocations and I want all of the running under the same transaction. After I'm done with the DAO objects I send a JMS message to the clients for updating.

    First question is:

    If I have declared all commands to run under a new transaction using the HibernateTransactionManager or JtaTransactionManager and I allow commands calling commands (like a chain of commands) can I make it work so that the transactions run in nested mode. I want the called command to reuse the calling commands transaction. Are there difference between the two transaction managers?

    Second question:

    Should I use the JtaTransactionManager since I need to guarantee that the JMS message comes through if and only if the Hibernate session commit with success. The JMS message is sent from the doExecuteCommand method in the command and since my transaction does not go through until the exit from that method I need to prevent the JMS messages from being sent if the transaction fails. Sounds like a JTA transaction covering Hibernate and the JMS queue, no?

    Third question:
    How the heck to you get the JtaTransactionManager up and running using the JBoss JNDI? It seems JBoss has there own implementation of javax.transaction.TransactionManager and when I deploy my WAR file and look up the TXManager (Jboss transaction manager implementation) the JtaTransactionManager does not recognize the class. I know that it should be solved by seeing to it that only the JBoss implementation of TransactionManager is available, but I guess the suns jta javax.transaction.* is present in my classpath or something. Any idess where to look for the javax.transaction (and yes I've looked for them in all my jars but cant find any)

    Well hope you guys got some answers for this, thanks