Transactionable
interface:
As you can see this is not so far away from the corresponding annotation:
Yah, you are right, I could write it better:
where Propagation
and Isolation
are defined as Enum
s. (This annotation is already in the Spring codebase: org.springframework.transaction.annotation.Transactional
).
But let's get back to our business. After defining the interface I need an annotation.properties
file where to declare the short name of the annotation:
so now I am able to write in a source:
Now, we will have to let AspectWerkz or backport175 weave the annotation into the .class
. To do this you have 3 different options:
- use the Eclipse plugin offered by AspectWerkz or backport175 projects
- use the AspectWerkz/backport175
org.codehaus.aspectwerkz.annotation.AnnotationC
/org.codehaus.backport175.compiler.AnnotationC
from the command line - use the AspectWerkz/backport175 Ant tasks (
org.codehaus.aspectwerkz.annotation.AnnotationCTask
, respectivelyorg.codehaus.backport175.compiler.task.AnnotationCTask
)
build.xml
where you have written the corresponding ant target. Now everytime you'll trigger a build on your project the selected target(s) will be run.
After these steps you are done. From now on, all is left to do is to choose correct API offered by either of the above mentioned projects to retrieve a Transactionable
instance at runtime (no sources are needed).
Update: a few moments ago I have finished reading the Ramnivas's article where one of the suggested usages is exactly on transactionability demarcation. I am glad I got a confirmation this idea is not stupid [smile/].
Post a Comment