Currently Spring supports different transaction management approaches:
- programmatic (through the direct usage of
PlatformTransactionManager
) - declarative (through the usage of
TransactionProxyFactoryBean
andTransactionInterceptor
) - declarative transaction demarcation through source level metadata (based on commons-attributes and
TransactionInterceptor
) - transaction demarcation based on real JDK1.5 annotations (I am not sure yet how they are working in background)
So my current solution is based on javadoc-like annotations and AspectWerkz taking into account that AspectWerkz allows the definition of pointcuts based on annotations (Note: the solution will work also with JDK1.5 annotations).
I have declared as in the previous post the
Transaction interface
, its corresponding annotation.properties
and now I define the following aspect:The full implementation of
TransactionManagerAspect
is based on the logic of TransactionInterceptor
and respectively TransactionAspectSupport
.
To end up this short entry I will present the pros and cons (at least those i can see by myself):
Pros
- non-public methods are allowed to be marked in transactions
- more refined pointcut definition (no regex naming usage needed)
Cons:
- metadata bound to source code and not external
- post-compilation annotation processing (required only for the javadoc-like annotations)
All is left is to drive some small benchmark to see what is the time consumption on each of the above solutions.
If any of you is interested in the full code drop me a line and I will try to package the things for you.
By the way: this is not a Mardi Gras entry [blink/].
1 comments:
Hi
I'm very interested for your code, so if you can, please send it to me on following email: damir.murat@zg.tel.hr.
Tnx
Damir Murat
Post a Comment