title: Spring integration test does not rollback
body: <p>I've done some research through the q&amp;a around here regarding the issue. many questions seem to address it, but not really.</p>
  
  <p>So here's the thing:</p>
  
  <ul>
  <li><p>I got a <code>CaseController</code>, which delegates to <code>CaseService</code>, which delegate in turn to <code>CaseRepository</code>.</p></li>
  <li><p>I got <code>@Transactional</code> on top of each method on <code>CaseServiceImpl</code></p></li>
  <li><p>I got a <code>CaseControllerIntegrationTest</code>, from which I perform RESTful requests to my <code>CaseController</code> and test full cycles.</p></li>
  </ul>
  
  <p>Problem is - my transactions are not rolled back.</p>
  
  <p>One of the tests is </p>
  
  <pre><code>@Test 
  public void verifyDeleteSuccessfulOnExistingCase() {
  
          final String urlWithPlaceholders = serverPrefix + RequestMappings.CASES_RESOURCE_MAPPING + "/{caseId}";
  
          final ResponseEntity&lt;CaseResource&gt; response =
                  restTemplate.exchange(
                          urlWithPlaceholders,
                          HttpMethod.DELETE,
                          null,
                          CaseResource.class, existingWsId_1, caseId);
  
          assertThat(response, notNullValue());
          assertThat(response.getBody(), nullValue());
          assertThat(response.getStatusCode(), is(HttpStatus.NO_CONTENT));
          assertThat(caseRepository.exists(caseId), is(false));
  
  }
  </code></pre>
  
  <p>In this test I delete a case which I had inserted for me in startup thanks to hibernate and import.sql</p>
  
  <p>Test is successful, problem is that I want to keep on addressing this case in the next tests, but the transaction seems not be rolled back, and the case is permanently deleted and not available for the next tests. </p>
  
  <ul>
  <li><p>I have tried moving <code>@Transactional</code> from <code>CaseServiceImpl</code> to the <code>CaseController</code>, yet it didn't make a difference.</p></li>
  <li><p>I can say that my lower lever <code>CaseRepositoryTest</code> successfully performs the rollback after each test.</p></li>
  </ul>
  
  <p>On top of <code>CaseControllerIntegrationTest</code> I got:</p>
  
  <pre><code>@ActiveProfiles("integration-test")
  @Transactional
  @TransactionConfiguration
  @IntegrationTest
  @WebAppConfiguration
  @RunWith(SpringJUnit4ClassRunner.class)
  @SpringApplicationConfiguration(classes = AppConfiguration.class)
  public class CaseControllerIntegrationTest {
  ...
  </code></pre>
  
  <p><code>AppConfiguration</code> looks like this:</p>
  
  <pre><code>@Configuration
  @EnableAutoConfiguration
  @ComponentScan
  @EnableTransactionManagement
  public class AppConfiguration {
  }
  </code></pre>
  
  <p>The db I'm using is <strong>hsqldb</strong></p>
  
  <p>Last important piece of info - The log actually indicates that the rollback was done:</p>
  
  <blockquote>
    <p>2014-05-15 07:54:44.391 TRACE -
    o.s.t.c.t.TransactionalTestExecutionListener - Ending transaction for
    test context [DefaultTestContext@2eb0cefe testClass =
    CaseControllerIntegrationTest, testInstance =
    om.services.casemanagement.web.CaseControllerIntegrationTest@5a2ae1ab,
    <strong>testMethod = verifyDeleteSuccessfulOnExistingCase</strong>@CaseControllerIntegrationTest,
    testException = [null], mergedContextConfiguration =
    [WebMergedContextConfiguration@2bec068b testClass =
    CaseControllerIntegrationTest, locations = '{}', classes = '{class
    om.services.AppConfiguration}', contextInitializerClasses = '[]',
    activeProfiles = '{integration-test}', resourceBasePath =
    'src/main/webapp', contextLoader =
    'org.springframework.boot.test.SpringApplicationContextLoader', parent
    = [null]]]; transaction status [org.springframework.transaction.support.DefaultTransactionStatus@3869a6e5];
    rollback [true]</p>
    
    <p>2014-05-15 07:54:44.403 INFO  -
    o.s.t.c.t.TransactionalTestExecutionListener - Rolled back transaction
    after test execution for test context [DefaultTestContext@2eb0cefe
    testClass = CaseControllerIntegrationTest, testInstance =
    om.services.casemanagement.web.CaseControllerIntegrationTest@5a2ae1ab,
    <strong>testMethod = verifyDeleteSuccessfulOnExistingCase</strong>@CaseControllerIntegrationTest,
    testException = [null], mergedContextConfiguration =
    [WebMergedContextConfiguration@2bec068b testClass =
    CaseControllerIntegrationTest, locations = '{}', classes = '{class
    om.services.AppConfiguration}', contextInitializerClasses = '[]',
    activeProfiles = '{integration-test}', resourceBasePath =
    'src/main/webapp', contextLoader =
    'org.springframework.boot.test.SpringApplicationContextLoader', parent
    = [null]]]</p>
  </blockquote>
  
  <p>I'm using Spring 4.0.3 distribution.</p>
  
  <p>Any ideas? </p>