I am trying to use spring AOP for transaction support in service layer, but it's not working please provide me the solution.
In my application i am using spring and hibernate.
following steps i have done to implement the transaction if i have missed any thing please guide me.
class PersonServiceProvider{
public void createPerson(...){
.....
calling the persistence layer for storing
eg personPersistence.save(..);
addressPersistence.save();
}
}
in each persistence layer am using the hibernate transaction for saving the data.
and xml configuration is
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="createPerson*" rollback-for="Throwable" propagation="NESTED"/>
</tx:attributes>
</tx:advice>
when an exception is raised in middle of PersonServiceProvider createPerson() method it's not rollbacking the data.
what should i need to rollback the data if an exception is raised.
I tried AOP transaction in stand alone application its working, but its not working in web application.
Can any one suggest me i followed same approach for both the ways.