This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction woes  RSS feed

Baba Bizlowsky
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody.

I would really be thankful if somebody explained me how to solve this problem. It's purely transaction-related and I'm completely stuck.

I have a session bean OrderHandler, MDB beans BusinessPartnerHandler and BusinessProcessController, and an entities Order and OrderStatus. Scenario goes like this:

- MDB bean BusinessProcess Controller gets an Order, instansiates session bean OrderHandler and calls its method to store the Order
- OrderHandler stores the Order, sets its status to "Stored"
- after that OrderHandler sends a JMS message to BusinessPartnerHandler to order some stuff from business partners. The message contains Order ID.
- BPHandler orders the stuff, sets the Order status to "Items ordered"

Everything looks nice and all, but upon finishing the scenario the Order status is, quite impossibly, "Stored". I debugged it with println's, and it seems that the BPHandler somehow sets the order's status BEFORE the OrderHandler does his work, although it's definitely not possible if you follow the code flow.

How do I solve this thing? I know it's a play with transactional attributes but I honestly don't know which ones to use and on which bean. Every possible combination I tried doesn't work.

Please help me if you can. Thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!