title: How to rollback test
body: <p>Here's my test:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = { "classpath:repositoryContextTest.xml" })
  @Transactional
  @TransactionConfiguration(defaultRollback = true)
  public class SeasonITest {
  @Autowired
  private SeasonDao seasonDao;
  
  @Test
  public void createSeason() throws Exception {
      Season season = new Season();
      season.setName("2012");
      seasonDao.createSeason(season);
  }
  </code></pre>
  
  <p>and the dataSource in my bean configuration file</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close"&gt;
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
      &lt;property name="url" value="jdbc:mysql://localhost/tournament_system" /&gt;
      &lt;property name="username" value="root" /&gt;
      &lt;property name="password" value="root" /&gt;
      &lt;property name="defaultAutoCommit" value="false"/&gt;
      &lt;property name="poolPreparedStatements" value="false"/&gt;
      &lt;property name="maxOpenPreparedStatements" value="0"/&gt;
   &lt;/bean&gt;
  
  &lt;bean id="transactionManager"
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
  &lt;/bean&gt;
  &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  </code></pre>
  
  <p>When I run this test there a new record is created in my database. </p>
  
  <p>How can I rollback this transaction?</p>
  
  <p>This is the log output I see:</p>
  
  <pre><code>2012-06-15 15:00:02,173 [main] INFO  - ionalTestExecutionListener - 
   Rolled back transaction after test execution for test context 
   [[TestContext@76db09 testClass = SeasonITest, 
     locations = array&lt;String&gt;['classpath:repositoryContextTest.xml'], 
     testInstance = org.toursys.repository.dao.SeasonITest@1265109, 
     testMethod = createSeason@SeasonITest, testException = [null]]]
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>all answers below want to change logic or database engine what I dont want. So I am offering reputation point to the right answer:</p>
  
  <p>Why when I have this:     <code>@TransactionConfiguration(defaultRollback = true)</code> in transaction configuration tests are not rolled back and how I can fix it ?</p>