Results 1 to 5 of 5

Thread: Multiple Transactions in a single transaction

  1. #1

    Default 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. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3

    Default Jms and DB transations in a JTAManager

    Quote 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
    Attached Files Attached Files

  4. #4
    Join Date
    May 2005
    Location
    Bucharest/Romania
    Posts
    14

    Default 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).

  5. #5

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •