I am using spring/hibernate. I have service layer and DAO layer. Transactions are placed in Service layer.
I have FirstServiceImpl class. In one of the method of FirstServiceImpl class it has 500 lines of code. what I did was I took all 500 lines of code and placed in a separate class(wrote one interface and implementation class. In the FirstServiceImpl class I autowired newly created interface to access its single method).
I placed @Transactional on FirstServiceImpl class.
My question is “does the newly created class logic also runs in Transactional context”?
Thanks!
I am not sure but I think it will use transaction propagation. But I can tell you sure way to test whether it works or not.
Do following database operation through your code in single transaction.
Before testing make sure your annotation is
@Transactional(propagation=Propagation.REQUIRED)