Kim Saabye Pedersen: Spring annotation on interface or class implementing the interface??
If Spring can't create a JDK proxy (or we force it to create a cglib proxy by setting the proxy-target-class to "true") then the code will not execute in a transactional context (just like the Spring documentation stated).
A warning: if you remove the call to TransactionInterceptor.currentTransactionStatus() the code will run without trowing an exception, but it will not run in a transactional context. Yes, you read it: no exception, no warning and no transactional context even though you have got the @Transactional annotation on the interface. I guess that is what is meant by ...the object will not be wrapped in a transactional proxy, which would be decidedly bad :)
A warning: if you remove the call to TransactionInterceptor.currentTransactionStatus() the code will run without trowing an exception, but it will not run in a transactional context. Yes, you read it: no exception, no warning and no transactional context even though you have got the @Transactional annotation on the interface. I guess that is what is meant by ...the object will not be wrapped in a transactional proxy, which would be decidedly bad :)
Read full article from Kim Saabye Pedersen: Spring annotation on interface or class implementing the interface??
No comments:
Post a Comment