Announcement Announcement Module
Collapse
No announcement yet.
Multiple Transactions in a single transaction Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Transactions in a single transaction

    Does anyone of you have prior experience of performing multiple transactions using spring?
    I want to achieve this where I have to perform atomic transaction which has multiple transactions. Hence there might be a scenario where we have to rollback Transaction 1 when transaction 2 fails (we can have JMS + DB - hibernate atomic transaction).

    Any pointers in this direction are welcome.

  • #2
    There is an article on WIKI which uses JMS and a DB datasource. Also if you serach the forum you'll find more threads on this topic.

    Comment


    • #3
      Jms and DB transations in a JTAManager

      Originally posted by costin
      There is an article on WIKI which uses JMS and a DB datasource. Also if you serach the forum you'll find more threads on this topic.

      Thanks Costin,
      What exactly i am doing is, I have a transaction manager(STPTransactionManager that implements javax.transaction.TransactionManager) which has 2 indipendent transactions javax.transaction.UserTransaction (JMSTransaction and HibernateTransaction) and i process them in a combined manner. Hence, i call begin for both and then process and finally i try to commit.

      I use org.springframework.transaction.TransactionStatus in order to do rollbacks or commits. This works fine in case i get an exception in the process method, but fails if one of the commit passes and second commit fails.

      At this time if i try to rollback the commited transaction, i get IllegalStateTransaction because session is commited.

      Can you please have a look at the code and advice.

      Also is there some way i can configure spring xml so that this is handeled automatically ?

      Many thanks
      Darshan

      Comment


      • #4
        Xa

        I think you should look into XA transactions (2-phase commit). This defines how to handle multiple transactions in etherogenous environment (f.e. DB + JMS).

        Comment


        • #5
          I managed to use JOTM for multiple transactions.
          Hence now i am able to use JMSTemplate send or recieve and Hibernate to commit as one trasaction.

          Now the problem is that if i want to wrap my transaction around onMessage method of MessageListener, i am not able to do that, nothing gets commited. Do i need to use Jenks, if yes can that be used in non-container (stand alone app) environment?

          Has anybody tried that ?

          Please help me out.
          Thanks
          Darshan

          Comment

          Working...
          X