odavid/typeorm-transactional-cls-hooked

Is propagation type SUPPORTS equivalent to no Transactional decorator?

Closed this issue · 3 comments

Suppose I have function foo() decorated with @transactional, calling function bar(). Do we get the same behavior if bar is decorated with @transactional({ propagation: Propagation.SUPPORTS }), or not decorated at all?
It seems that way by looking at the logs of start and commit transaction, but I'm not sure this is guaranteed.

Hi @ydinari ,

The answer is yes.
SUPPORTS means that it supports the current transaction, but will run without transaction if there is no current transaction.

Hope it helps

Thanks!
Then is there a use case where I need to use Transaction({propagation: Propagation.SUPPORTS})?