Grokking Java Interview Questions
Vote

0% completed

​

Proxies, AOP, and Transactional

The method placeOrder() of a Spring bean carries the annotation @Transactional, and it prints whether a database transaction is active. The same method printed these two lines in one run:

placeOrder(1001), transaction active: true placeOrder(1002), transaction active: false

Order 1001 was placed by code outside the bean. Order 1002 was placed by a second method of the same bean, which called placeOrder(1002) directly. The annotation and the method were the same, so why did the second call run with no transaction?

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content