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.