Spring Transaction not rolling back
<p>I have something like this:</p>

<pre><code>@Service
@Transactional
public class ServiceA {

    @Autowired
    SomeDAO1 dao1; 

    @Autowired
    ServiceB serviceB;

    public void methodServiceA() {

        serviceB.someMethodThatRunsInsertIntoDB(); 
        dao1.anotherMethodThatRunsInsertIntoDB(); 

    }

}

@Service
@Transactional
public class ServiceB {

     @Autowired
     Dao2 dao2;

     public void someMethodThatRunsInsertIntoDB() {
          dao2.insertXXX();
     }

}
</code></pre>

<p>My problem is: if <code>serviceB.someMethodThatRunsInsertIntoDB()</code> executes sucessfully but <code>dao1.anotherMethodThatRunsInsertIntoDB()</code> throw an exception, the changes made by <code>serviceB</code> are not rolled back. I need to rollback those changes in case an exception occur in <code>dao1.anotherMethodThatRunsInsertIntoDB()</code>. How can I do this?</p>

<p>// EDITED</p>

<p>Transaction configuration in spring-servlet.xml</p>

<pre><code>&lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
    &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
    &lt;property name="jpaDialect"&gt;
        &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" /&gt;
    &lt;/property&gt;
&lt;/bean&gt;
</code></pre>

<p>Is it relevant if one dao uses an EntityManager and the other dao uses JdbcTemplate to interact with DB?</p>

<p>//UPDATE -- EntityManager configuration</p>

<pre><code>&lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
    &lt;property name="dataSource" ref="dataSource" /&gt;
    &lt;property name="jpaVendorAdapter"&gt;
        &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
            &lt;property name="showSql" value="true" /&gt;
            &lt;property name="generateDdl" value="true" /&gt;
        &lt;/bean&gt;
    &lt;/property&gt;
</code></pre>

<p></p>