ejb@glassfish.java.net

overloaded business methods and their transaction attribute

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Thu, 07 Sep 2006 13:31:22 -0400

In the following bean superclass, my intention is that foo() has
transaction attribute Mandatory, and foo(String) and foo(String,
String) has the default Required. There is no ejb-jar.xml. The actual
bean class doesn't override any business methods.

abstract public class TxBeanBase implements TxRemoteIF, TxLocalIF {
    @TransactionAttribute(TransactionAttributeType.MANDATORY)
    public String foo() {
        return "foo";
    }

    public String foo(String s) {
        return s;
    }

    public String foo(String s, String ss) {
        return s + ss;
    }

After deployment, the generated ejb-jar.xml contains the following:
<container-transaction>
<method>
<ejb-name>EBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>foo</method-name>
</method>
<trans-attribute>Mandatory</trans-attribute>
</container-transaction>

According to ejb3 spec 13.3.7.2.1, the above will apply to all
overloaded business methods named foo. Now all 3 foo methods have
Mandatory. <method-params> is not used anywhere in the generated
ejb-jar.xml. It appears this generated ejb-jar.xml is incorrect. An
empty <method-params/> element needs to be there to distinguish foo()
from foo(*).

Let's just accept the generated ejb-jar.xml. We would expect all foo
methods have transaction attribute Mandatory. When I invoke foo(String)
and foo(String, String) without any transaction context, there is no
exception. It seems the two methods are still executed with transaction
attribute Required. So something in transaction attribute enforcement
is incorrect.

This is similar to the issue regarding @Interceptors on overloaded
business methods (issue <BT6437374>). Could someone verify?

-- 
Cheng