Transaction Management Question

Discussions

EJB programming & troubleshooting: Transaction Management Question

  1. Transaction Management Question (1 messages)

    1. I have a stateless session bean where one of the public method performs some commit operations and has some transaction attribute set as (Required/RequiresNew). It also calls lot of its own private helper methods which also perform some commit time operations.

    I wanted to know what transaction context would apply to these private helper methods.

    2. Also, I have (n) number of public methods in session bean and have applied Transaction Attributes in ejb-jar.xml to only some of them. What transaction context will get applied to those public methods for which no transaction attribute is specified in ejb-jar.xml
  2. "I wanted to know what transaction context would apply to these private helper methods."

    The private methods operate within the transaction context of the method that called it.

    "What transaction context will get applied to those public methods for which no transaction attribute is specified in ejb-jar.xml?"

    If no transaction attribute is specified, the transaction attribute is defaulted to "Bean Managed", i.e. the developer is responsible for making sure that the method is transactional.

    Note that a method with a transaction attribute declared would not be able to call any method that handles its own transactions...a RemoteException would be thrown. A CMT method must not encounter any situation that alters the transaction boundaries.

    Hope this helps.