Announcement Announcement Module
No announcement yet.
Is transaction already in progress using AOP Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is transaction already in progress using AOP

    New to Spring. Using version 2.5

    Would like your advise on how to accomplish the following scenarion:

    A transaction spans the following methods:
    Sevice1.method1() -> DAO2.method2() ->DAO3.method3()

    My question is, is there any way of knowing that the transaction is already in progress when I call DAO2.method2()? In other words, is there a way of knowing that transaction is NOT new when DAO2.method2() is getting invoked?

    Can I resolve it by specifying specific propagation rule for Service and DAO?

    More than likely, Service will call DAO. If Service calls DAO, then Service->DAO will be a part of one transaction. However, JUnit will call DAO directly, thus bypassing Service. As such, for JUnit, transaction starts when DAO is called. I need to accommodate for this scenario and still need to know if the transaction is already in progress, or brand new; whenever a method in Service, or a method in DAO gets called.

    Any advice will be appreciated.