title: Spring Test transaction not rolling back
body: <p>Using the spring testing framework, my transactions do not roll back and I have absolutely no idea why. I've spent a good few days trying to find answers on SO but to no avail so I decided to post.</p>
  
  <p>Testfile</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration("/applicationContextTest.xml")
  @Transactional
  public class joinTest {
  
  @Autowired
  private DAO AccountDAO;//My DAO is annotated with @Repository
  
  
  @Before
  public void beforeMethod()
  {
      //log4j append code
  }
  
  @Test
  public void saveMethod()
   {
      Account acct = new Account();
      acct.setUsername("USER");
      SmokeEvent evt = new SmokeEvent();
      evt.setDateSmoked(new DateTime());
      evt.setAccount(acct);
      AccountDAO.addSmokeEvent(evt);
      }
  }
  </code></pre>
  
  <p>applicationContext.xml</p>
  
  <pre><code>&lt;context:component-scan base-package="com.abstinence.Logic"/&gt;
  &lt;context:annotation-config/&gt;
  
  
  &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="org.hsqldb.jdbcDriver"/&gt;
      &lt;property name="url" value="jdbc:hsqldb:hsql://82.165.173.127/testdb"/&gt;
      &lt;property name="username" value="SA"/&gt;
      &lt;property name="password" value=""/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
      &lt;property name="packagesToScan" value="com.abstinence.Logic"/&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key ="dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/prop&gt;
              &lt;prop key="javax.persistence.validation.mode"&gt;none&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;tx:advice id="txAdvice"&gt;
      &lt;tx:attributes&gt;
          &lt;tx:method name="*"/&gt;
      &lt;/tx:attributes&gt;
  &lt;/tx:advice&gt;
  
  &lt;aop:config&gt;
      &lt;aop:pointcut id="hibernateDAOOperation" expression="execution(* com.abstinence.Logic.AccountDAO.*(..))"/&gt;
      &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="hibernateDAOOperation"/&gt;
  &lt;/aop:config&gt;
  
  &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I have checked the logs from log4j. The unusual thing is there is no mention of a rollback anywhere. There is a mention of the logs creating a session and inserting the data into the database but nothing about a rollback.</p>
  
  <p>Someone please help me</p>