Hi Mahesh,
If your generated ejb-jar.xml looks like mine, it means the first error
is reproduced (incorrect ejb-jar.xml generation at deployment time)?
In your Sless ejb, the expected transaction-attributes are: foo() has
Mandatory, foo(String) has Required, and foo(String, String) has
Required. If you call foo() and get EJBTransactionRequiredException,
that's good. But calling foo() won't expose the incorrect behavior.
Even if we get the expected result, that may be false positive, since
there are 2 errors involved (descriptor generation and tx execution).
In your example, calling sless.foo(String) will always succeed, whether
it has Required or Mandatory, since there is always a pre-existing tx.
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void txRequired() {
sless.foo("txMandatory");
}
Thanks for looking into this.
Cheng
Mahesh.Kannan wrote:
> Hi Cheng,
> I couldn't reproduce this problem. The xml does indeed look like
> yours but the foo method thorws the correct TxRequired(Local)Exception.
> --Mahesh
>
> Cheng Fang wrote:
>
>> 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?
>>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>