Results 1 to 10 of 10

Thread: Transaction aspect order

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    10

    Default Transaction aspect order

    I'm using Spring 2.0 declarative transactions with <tx:annotation-driven/> and want an interceptor to be called *before* commit.

    The problem is that the "order" property of the transaction aspect is Integer.MAX_VALUE so I can't use a higher value in my aspect.

    As a workaround I'm also using Integer.MAX_VALUE and it is actually being called before commit, but I'm worried if it is just by luck.

    And what if I have more aspects that must be ordered before commit? Is it possible to change the order property of transaction aspect? The assumption that nothing will intercept after "begin transaction" and before "commit" is too restrictive...

  2. #2
    Join Date
    Mar 2007
    Posts
    515

    Default

    Doesn't <tx:annotation-driven/> have an 'order' attribute, also, to adjust the order aspects are applied ?

  3. #3
    Join Date
    Aug 2004
    Posts
    10

    Default

    Unfortunately not...

  4. #4
    Join Date
    Mar 2007
    Posts
    515

    Default

    'order' attribute has been added starting with Spring version 2.0.3.
    Take a look at this thread for more details.

  5. #5
    Join Date
    Aug 2004
    Posts
    10

    Default

    Thanks! I didn't noticed it before, my IDE was lying to me...

    My problem now is how to put the aspect order from a static field into an attribute! If only it was a property...

    It seems that I will need to convert tx:annotation-driven into a explicit transaction configuration with advices, attributes, etc... Or there is another way?

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Why? simply specify an order attribute on the annotation-driven tag. If you want it to be referenced from a static from inside a class use a ConstantsBean. Check the util:constant namespace for that.

    Code:
    <tx:annotation-driven order="1"/>
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •