After more reading, I reliazed that I am getting myself into "dist transaction" domain so I did the following:
- Implemented SessionSynchronization in my stateful session bean.
- Modified my business methods to cache the JMS messages in a member of the session bean.
- in "afterCompletion()" I am submitting the JMS messages to the queue (changed it back to XConnFactory instead of JmsXA)
- On the MDB side, I can read attributes from my entity beans but when I try to remove it , it thows ClassCastException on the PK class
My PK class is basically an Integer generated by xdoclet
Anybody help ... PLEASE.
Yet another LOW point in my career as software designer.
I found what was the problem and it has nothing to do with transactions
I was doing remoteHome.remove(remoteInterface) which is failing becuase it expects a PrimaryKey (that's explain the Cast error).
I don't know which transaction model should I follow
- use JmsXA and enlist the JMS in the transaction [ I noticed sometimes
the following message
18:56:47,578 WARN [TxConnectionManager] Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure.
- use afterCompletion(true) to send my JMS
Thanks for your help