Transaction length

Discussions

EJB design: Transaction length

  1. Transaction length (3 messages)

    Hi all,
    I have a little doubt about transaction length.

    Suppose I have an entity bean with two method:

    methodOne() (with trans. attribute = RequiresNew)
    methodTwo() (with trans. attribute = Required)

    If a client (for example a Session Bean)
    calls methodOne() is it true that
    the transaction starts at the beginning
    of methodOne()'s execution ?

    If methodOne() calls methodTwo() is the same
    transaction propagated to methodTwo() ?

    In every case am I sure that at the end of
    methodOne() execution transaction will end ?

    Suppose that methodOne() DOESN'T USE method two:
    in this case if my client calls methodOne()
    and methodTwo() separately is it true that I'll have
    two distinct transactions (T1 during methodOne's
    execution and T2 during methodTwo's execution) ?

    Many thanks
    Moreno

    Threaded Messages (3)

  2. Transaction length[ Go to top ]

    I made a mistake in the previous post:

    methodOne() and methodTwo() are part of a Session Bean
    and the client is a java application (not a Session Bean)

    Moreno
  3. Transaction length[ Go to top ]

    Hi Moreno,

    As far as if methodA() doesn't invoke methodB() then methodA() run in a new Transaction Context and methodB() also run in a different Transaction Context.
    Yes transaction starts as soon as methods are invoked and completed once method completes.

    If the methodA() invkoes methodB() then same transaction is propagated to methodB() by the container.that is for surety.

    Over and above this I had also one doubt, if a client invokes methodA() which in turn invokes methodB() and before completion of methodB() another client invokes methodB() does the container creates another Transaction Context or run in the same or throws an exception.

    Regards,
    Moreno
  4. Transaction length[ Go to top ]

    Mogit Gupta wrote:

    >Over and above this I had also one doubt, if a client invokes methodA() which in turn invokes methodB() and before completion of methodB() another client invokes methodB() does the container creates another Transaction Context or run in the same or throws an exception.

    If there are two clients, there are also two beans (for example
    two Stateful Session beans) that clients use,
    client one calls methodA() of his own bean, the same for client B ...
    so the container creates two different Transaction Context.

    Moreno