I have the following scenario. I am using JPA, Spring:
@Autowired
SampleService service;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Ex
Spring transactions are proxy-based. Here's thus how it works when bean A causes a transactional of bean B. A has in fact a reference to a proxy, which delegates to the bean B. This proxy is the one which starts and commits/rollbacks the transaction:
A ---> proxy ---> B
In your code, a transactional method of A calls another transactional method of A. So Spring can't intercept the call and start a new transaction. It's a regular method call without any proxy involved.
So, if you want a new transaction to start, the method createSampleObject() should be in another bean, injected into your current bean.
This is explained with more details in the documentation.