Spring TransactionManager; what means isNewTransaction() exactly?

83 Views Asked by At

I am converting a legacy application to spring-boot. For the API-implementation I want to annotate it with @Transactional, but need to implement a custom transactionManager.

When I define:

@Component 
public class MyTransactionManager implements PlatformTransactionManager { ... }

the interface PlatformTransactionManager requires three methods be implemented...

commit() and rollback() are obvious.

But getTransaction() should return a type TransactionStatus with a method boolean isNewTransaction()

What exactly is the purpose of this return value? When should it return true vs false?

If I have no nested transaction, is it OK to always return true? (or always false?)

0

There are 0 best solutions below