Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 2V0-72.22 topic 1 question 8 discussion

Actual exam question from VMware's 2V0-72.22
Question #: 8
Topic #: 1
[All 2V0-72.22 Questions]

Refer to the exhibit.

Assume that the application is using Spring transaction management which uses Spring AOP internally.
Choose the statement that describes what is happening when the update1 method is called? (Choose the best answer.)

  • A. There are 2 transactions because REQUIRES_NEW always runs in a new transaction.
  • B. An exception is thrown as another transaction cannot be started within an existing transaction.
  • C. There is only one transaction because REQUIRES_NEW will use an active transaction if one already exists.
  • D. There is only one transaction initiated by update1() because the call to update2() does not go through the proxy.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Evoila_TrainingMaterial
1 month, 1 week ago
Selected Answer: D
n Spring, transaction management relies on Spring AOP (Aspect-Oriented Programming), which means transactions are managed through proxies. For a new transaction (like one specified with REQUIRES_NEW) to be started within an existing transaction, the method must be called through a Spring proxy. In the code provided, update1 calls update2 directly. This means the call does not go through the Spring proxy, and hence, the REQUIRES_NEW propagation on update2 is not recognized. As a result, there is only one transaction, which is the one initiated by update1. If update2 were to be called in a way that went through the proxy, such as through another Spring-managed bean, a new transaction would indeed be started because of the REQUIRES_NEW propagation. However, the direct call prevents this from happening, leading to only one transaction.
upvoted 1 times
...
2211094
2 months, 1 week ago
A is correct
upvoted 1 times
...
Ancient1
1 year, 1 month ago
Selected Answer: D
Answer is D. Based on the lecture video from Vmware's training course (Spring framework essentials> Module 9 > Configure Transaction Propagation): The first update method will create a transaction and run in a proxy, and when the second update method is called, it will be executed within the same transaction in the same proxy.
upvoted 4 times
Ancient1
1 year, 1 month ago
Now you might be asking, why would it execute within the same transaction if the propagation is REQUIRES_NEW? Wouldn't it create a new transaction? Normally yes, however, In this case, the update2() method is being called in the same class as the first update(), making it an internal call. When the first update method was called the @Transactional annotation passed the method execution to the interceptor, which created a proxy for the transaction (Spring AOP). When the Internal call to the second update2() method was executed, it couldn't be intercepted by a new interceptor, therefore, it couldn't create its own transactional proxy, which means it cannot create a new transaction. If you don't understand this concept right away, don't worry. I had to review the video several times and I'm still trying to wrap my head around it.
upvoted 1 times
Azuni
1 year ago
Same here. Luckily the instructor in the video did mention this and illustrated this in his slides 3:42 minutes into the video. Took me a while to filter though all the stuff.
upvoted 1 times
...
...
...
Azuni
1 year, 1 month ago
Selected Answer: A
The answer should be A. There should be two transactions. The first one will be suspended when the second one is called and once the second transaction is done, the first one will become active again. Please refer to the Spring Docs on the topic of Transaction propagation: https://docs.spring.io/spring-framework/reference/data-access/transaction/declarative/tx-propagation.html
upvoted 1 times
Azuni
1 year, 1 month ago
UPDATE: I went though the VMWare Spring Framework Essentials lecture video where they used this exact example. The answer is indeed D. Feel to stupid for my original post. Apologies for the confusion.
upvoted 3 times
...
...
Verixas
1 year, 5 months ago
The option D is correct due to this article, where this case resolved - https://www.marcobehler.com/guides/spring-transaction-management-transactional-in-depth
upvoted 2 times
...
rhuanca
1 year, 5 months ago
I think is A correct answer Option B is incorrect because an exception is not thrown when using REQUIRES_NEW propagation. Option C is incorrect because REQUIRES_NEW will always create a new transaction even if an active transaction is present. Option D is also incorrect because the call to update2() does go through the proxy and the transactional behavior will be applied.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...