Announcement Announcement Module
Collapse
No announcement yet.
self-invocation and @transactional in proxy mode Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • self-invocation and @transactional in proxy mode

    Note: In proxy mode (which is the default), only 'external' method calls coming in through the proxy will be intercepted. This means that 'self-invocation', i.e. a method within the target object calling some other method of the target object, won't lead to an actual transaction at runtime even if the invoked method is marked with @Transactional!
    So this means that if a method on my service layer object that IS marked transactional, and in turn calls another method that IS marked transactional, the things done in the 2nd method won't be included in the first transaction? what if the 1st one isnt marked transactional and the 2nd one is?

    these limitations won't affect me if i'm using aop pointcuts configured in the app context right?

  • #2
    bumping this in the hopes of a reply

    Comment


    • #3
      So this means that if a method on my service layer object that IS marked transactional, and in turn calls another method that IS marked transactional, the things done in the 2nd method won't be included in the first transaction?
      The transaction is tied to the thread so the 2nd method execution takes place in the same transaction.

      what if the 1st one isnt marked transactional and the 2nd one is?
      Then there is no transaction because the proxy only invokes method 1 (in proxy mode, which, as you have found is the default, and by far the most common usage).

      these limitations won't affect me if i'm using aop pointcuts configured in the app context right?
      Wrong. Unless you enable load-time weaving (then it's not proxy mode).

      Comment

      Working...
      X