That was an interesting question. It might depend on the container implementation. EJB spec said that if transaction attributes are not specified for the methods of an enterprise bean, the Deployer will have to specify them. Also providing an assembly-descriptor in the deployment descriptor is optional for the ejb-jar file producer. I guess when bean is deployed methods are assigned some default transaction attribute value. I tested it on WebSphere 5.1. It also allows to omit assembly-descriptor. I created 3 beans: bean1.method() which calls bean2.method() which calls bean3.method(). bean1.method() has transactional attribute Never, I did not specify anything for bean2.method(), bean3.method() has Mandatory. When I call bean1.method() from a client it did not throw any exceptions. So I assume for WebSphere 5.1 when transactional attribute is not specified for
the method of CMT bean it will use Required or RequiresNew( you would have to refine this test more to find out if it is Required or RequiresNew)
I changed this test. I set bean1.method() to RequiresNew and before returning from bean2.method() I called setRollbackOnly() in bean2.method(). Then I printed getRollbackOnly() in bean1.method() and it was set to true. It means they were using the same transaction. So if you don't specify transactional attribute for WebSphere 5.1 it will be set to Required.
[ February 22, 2004: Message edited by: Victor Lar ]