0
votes

I have two services both are transactional with propagation REQUIRED. Service 2 is injected in service 1.Now method A in service 1 calls method B of service 2. Now I am invoking method A from client.My question is whether this invocation will

Create 1 transaction in which is created by Method A and method B will run in same transaction Or Create 2 transactions one for method A and other when A is calling B.

In my project services are transactional and for performing compound operations we have injected services inside other services.

1

1 Answers

0
votes

From REQUIRED java-doc:

Support a current transaction, create a new one if none exists.

In your case - your variant is 1.

Note: You can control the creation of your transactions by enabling debug logging for org.springframework.orm.jpa.

More info from official doc.