title: Spring @Transaction does not rollback on Exception thrown
body: <p>I've searched around for this question, there's quite a few of them here on StackOverflow and Google but I can't seem to get anything working for me.</p>
  
  <p>here are my codes
  Spring config: (I dont use any pointcut - I think I dont need to?)</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
  ...
  &lt;/bean&gt;
  
  &lt;bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
   &lt;property name="dataSource" ref="dataSource" /&gt;
   ...
  &lt;/bean&gt;
  
  &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="hibernateSessionFactory"/&gt;
  &lt;/bean&gt;
  &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  </code></pre>
  
  <p>I have a Service class:</p>
  
  <pre><code>@Service
  public class ServiceImpl implements ServiceInterface 
  {
      /**
       * Injected session factory
       */
      @Autowired(required=true)
      private SessionFactory sessionFactory;
  
      @Autowired(required=true)
      private Dao myDao;
  
      /**
       * {@inheritDoc}
       */
      @Transactional(rollbackFor=Exception.class, propagation=Propagation.REQUIRED)
      public void scheduleBlast(BlastParameters blastParameters) throws ServiceException 
      {
          ... do bunch of stuff ..
          myDao.persist(entity)
  
          if(true)
              throw new ServiceException("random error")
      }
  
      .. setter methods and other stuff ..
  }
  </code></pre>
  
  <p>and a Dao class:</p>
  
  <pre><code>public class DaoImpl implements DaoInterface
  {
      @Autowired(required=true)
      private SessionFactory sessionFactory
  
      /**
       * {@inheritDoc}
       */
      @Transactional(propagation=Propagation.MANDATORY)
      public void persist(Entity e) throws DaoException
      {
          try
          {
              sessionFactory.getCurrentSession().persist(e);
          }
          catch(Exception ex)
          {
              throw new DaoException(ex);
          }
      }
  
  
      .. setter methods and other stuff ..
  }
  </code></pre>
  
  <p>Some unnecessary details are eliminated (eg. missing setter, etc), assume that code works perfectly fine. </p>
  
  <p>My problem with the above is that when I added the throw random exception line, it does not rollback, the object being persisted through the DAO stays in the db.</p>
  
  <p>I am using Spring 3.1 and Hibernate 3.6 (because there was a bug with Hibernate 4.0 on Spring 3.1)</p>
  
  <p>Thoughts?</p>
  
  <p>Thank you</p>