title: Spring JMS Testing and Transactional Rollback
body: <p>I have a test harness using Spring's <code>SpringJUnit4ClassRunner</code> (which automatically rolls back DB updates at the end of each JUnit test).  Now I want to test my Spring-based JMS code:</p>
  
  <ol>
  <li>Some DB item is created</li>
  <li>A JMS message is sent to do something</li>
  <li>The MDP picks up the message and does something else in the DB</li>
  </ol>
  
  <p>What is actually happening in the Test is the following:</p>
  
  <ol>
  <li>Spring begins the transaction (tx1) on thread 1</li>
  <li>The DB item is created in the tx1 context</li>
  <li>The JMS message is sent</li>
  <li>Transction tx1 is rolled back and thread 1 exits</li>
  <li>Thread 2 spins up the MDP, begins transaction tx2, reads the message, and does DB work</li>
  <li>Thread 2 commits tx2, as its not spun up by the test harness, and exits</li>
  </ol>
  
  <p>What I want to have happen is for tx1 and tx2 to both be controlled by <code>SpringJUnit4ClassRunner</code> so I get the automatic rollback.  Even better would be if they could share the same overall transactional context; right now, if something is saved in tx1, even if Thread 1 hasn't rolled back that tx, tx2 doesn't see the DB changes.</p>