title: DBUnit load dataset and rollback
body: <p>I'm having troubles setting this to work. Basically I want when a tests finishes running for the database to be in the exact same state as before. This happens when using Spring/Hibernate managed sessions and connections, but not for DBUnit. I've tried lots of things and at this point I was doing something like wrapping the shared datasource in <code>TransactionAwareDataSourceProxy</code> and executing the load dataset manually instead of using <code>@DatabaseSetup</code>.</p>
  
  <pre><code>this.databaseConnection = new DatabaseConnection(dataSource.getConnection());
  IDataSet xmlFileDataSet = new FlatXmlDataSetBuilder().build(getClass().getResourceAsStream("/dataset.xml"));
  DatabaseOperation.REFRESH.execute(databaseConnection, xmlFileDataSet);
  </code></pre>
  
  <p>And it simply doesn't work. I've checked the dataSource object and it's a <code>TransactionAwareDataSourceProxy</code> instance so everything should be in place. All the data in the dataset is committed and persisted and all the data added/modified inside the spring managed session is not.</p>
  
  <p>Does anyone have a clue what I might be missing or any did this before and ran into the same troubles?</p>
  
  <p>Current code (tried with and without TransactionAwareDataSourceProxy).</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = {
          RecipeManagementITConfig.class,
          SpringJpaTestConfig.class,
          DatabaseITConfig.class
  },
          initializers = {PleaseWork.class})
  @TestExecutionListeners({
          DependencyInjectionTestExecutionListener.class,
          DirtiesContextTestExecutionListener.class,
          TransactionalTestExecutionListener.class,
          DbUnitTestExecutionListener.class
  })
  @TransactionConfiguration(defaultRollback = true)
  @Transactional
  public class DefaultIngredientServiceIT {
  
  @Autowired
  protected DataSource dataSource;
  
  
  @Before
  public void init() throws Exception {
      System.out.println("&gt; " + dataSource); // org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy@d4ce346
      dbTester = new DataSourceDatabaseTester(dataSource);
      dbTester.setDataSet(getDataSet());
      dbTester.setSetUpOperation(DatabaseOperation.REFRESH);
      dbTester.onSetup();
  }
  
  @After
  public void destroy() throws Exception {
      dbTester.onTearDown();
  }
  
  private IDataSet getDataSet() throws Exception {
      return new FlatXmlDataSetBuilder().build(getClass().getResourceAsStream("/dataset.xml"));
  }
  
  @Transactional
  @Test
  public void testDeletionOfIngredients() {
     (...)
  }
  </code></pre>
  
  <p>}</p>