title: JMS and JTA Transactions in Java EE
body: <p>I think I am not getting something right with JMS and JTA. I am running in a Java EE container with all CMTs. Here is what I am doing:</p>
  
  <ol>
  <li>In an SLSB, write something to the database</li>
  <li>From the same method of the SLSB, post a message to a JMS queue</li>
  <li>An MDB in the same container listens to the JMS queue and picks up the message</li>
  <li>The MDB reads the database</li>
  </ol>
  
  <p>The problem is, the MDB does <em>not</em> see the changes made to the database in step 1.</p>
  
  <p>I verified that steps 1 and 2 happen inside a single XA transaction, as expected. My expectation is that a second XA transaction would start at step 3, after the first XA has been committed. But it seems that the MDB receives the message before the XA transaction that posted the message has been committed.</p>
  
  <p>Is my expectation wrong and what I am seeing is normal?</p>
  
  <p>I am running under JBoss 6. The SLSB is local. Both the SLSB and the MDB are in the same application.</p>