• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Transaction Mangement with Spring JTA

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to persist the data and post a message to MDB (let us say 'responseMDB')

The transaction is started from MDB (Let us say 'request MDB'), within the On message i do persist as well as posting the message.

It works fine but in case of any exceptions the persistance/posting message are not rolled back.

I believe my transaction configuration is not correct.

Following are the details
MDB :- Container managed transaction

Spring Configuration :-



Can i know what is it i am doing wrong
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a reason why you are using the HibernateTemplate. If you are using Hibernate pre 3.1 version, then the template is helpful to hide boilerplate code. If you are using 3.1 or higher it gives you no benefits at all and writing straight Hibernate/JPA code is actually better and more portable than the template.

When it comes to messaging and transactions, there is only so far the transaction can be wrapped around. So it sound like the message is already sent to a queue before the transaction has rolled back, so therefore no longer available to revert.

But you haven't posted your MDB stuff and where your transaction boundary is or its settings to help more.

Mark
 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marks,

Firstly Thanks for your reply

Can i have the example/guide for the below
"If you are using Hibernate pre 3.1 version, then the template is helpful to hide boilerplate code. If you are using 3.1 or higher it gives you no benefits at all and writing straight Hibernate/JPA code is actually better and more portable than the template."

Following are my MDB settings


EJB Code


 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see or understand how an EJB MDB is connected to your Spring configuration. They seem separate and therefore I see the MDB in a transaction from the JTA and App Server but not in the Spring transaction. I am missing something, or that is your problem is that they aren't connected. Also you are swallowing any exception and therefore the transaction won't rollback in the MDB.

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic