I have a @Service called from two different sites.
From the class1 there is a context which apply transactionality through <aop pointcut>
From the class2. Its extends a class which is @Transaction annoted.
Apparetly both places apply transaction correctly but is not. My test are split up in two types:
- Insert data in a object and save the object (which is an entity). After this fill other object and save this object (an entity too). Until the process finish, the first object is not commit never. And if the process is stop before finish any commit are carried out. So thats work fine because I want to have every commit in the same transaction. All success or all fail.
- In the second test there are 2 methods in the @Service. These methods make as the previous, fill in an object and save it. The problem is: enter in the method 1, and commit. Enter in the method 2 and stop the application. There is no rollback for the method 1, so the data are commited.
The problem of the second test happend when the @service is called from the class which inherit @Transactional. When the @Service is called from the class with aop pointcut it works fine in both test.
I dont find any conflict between @Transaction and pointcut in the documentation. And I dont understand why transactionality works in the @Service but not in the methods called from.
I hope being clear in the explication.