DD requires that transaction-type is required sub element of session and message-driven. Your container should detect this when it deployers your ejb-jar.jar file. May ask what container you are using?
You did not specify what transaction attribute? What EJB container are you using?
posted 16 years ago
I'm using JBoss 3.2.3. Do you think that properly coded bean with the following DD will not deploy and run?
Pay attention that <aassembly-descriptor> part is misssing, the place where transaction attributes are specified(RequiresNew, Required, Never, etc...). If our uniquiely :-) named BeanStatefullBean has one method getSomething() for example, will the container start a transaction when this method is exected? [ February 22, 2004: Message edited by: Todor Mollov ]
posted 16 years ago
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 ]
New rule: no elephants at the chess tournament. Tiny ads are still okay.
Devious Experiments for a Truly Passive Greenhouse!