Transaction Propagation Question

Discussions

EJB design: Transaction Propagation Question

  1. Transaction Propagation Question (3 messages)

    Please note the following steps:
    1) A session bean method is invoked and starts a transaction.
    2) The session bean calls a POJO (perhaps a delegate or something).
    3) The POJO invokes a method on a separate session bean that can support an existing transaction context.

    I am assuming the transaction will not propagate automatically through the POJO to the other session bean. Is that a correct assumption? If so, how would I manually handle the propagation through the POJO method?

    Thanks in advance for helping me clear this up!
  2. RE: Transaction Propagation Question[ Go to top ]

    Assuming my initial assumption is correct:

    As a follow-up, do I need to pass the JTA transaction context as an argument to the POJO? How would I then propagate the transaction context to the second session bean?
  3. Bill,

    The TX Context is tied to the current thread, otherwise you would not be able to use Business Delegate Pattern. Just don't do anything in the POJO to break any EJB restrictions (threading, filesystem access, etc.) and the POJO thread-safe. As long as this is followed you can wrap your EJB Access in as many POJO as you like and still maintain TX Context as specified in your DD.

    Goodluck

    Mike
  4. Thanks for your help Mike. I appreciate it.