Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.616 :

Posted: Mon Feb 02, 2015 5:35 pm
by renatumb
On explanation is mentioned:
" ...deployment descriptor values always override annotation values (except structural information such as bean type ... "
If a bean has the following code:

Code: Select all

@javax.ejb.Stateful
public class x019_Teste{
}

and the following DD

Code: Select all

<enterprise-beans>
        <session>
            <ejb-name>x019_Teste</ejb-name>
            <ejb-class>pkg001.x019_Teste</ejb-class>
            <session-type>Stateless</session-type>
        </session>
<enterprise-beans>
Which will its type be? Stateless of Stateful ?
Based on explanation above, it will be a STATEFUL ...but on Glash Fish, it is a STATELESS
So... what should I consider for the exam?

Re: About Question enthuware.oce-ejbd.v6.2.616 :

Posted: Mon Feb 02, 2015 10:36 pm
by admin
Glassfish is wrong. As per section 19.2:
Structural information describes the structure of an enterprise bean and declares an enterprise bean’s external dependencies. Providing structural information for the ejb-jar/.war file producer. Structural information may be provided using metadata annotations in the beans’ code or in the deployment descriptor. The structural information cannot, in general, be changed because doing so could break the enterprise bean’s function.

If the bean’s type has been specified by means of the Stateless, Stateful, Singleton, or MessageDriven annotation, its type cannot be overridden by means of the deployment descriptor. The bean’s type (and its session type), if specified must be the same as that specified in annotations.

Re: About Question enthuware.oce-ejbd.v6.2.616 :

Posted: Tue Jun 02, 2015 10:18 am
by himaiMinh
Option 2:
To be able to call doStuff(), the client must be in role "customer"
This case, it is because the deployment descriptor values overrides the annotation values in the bean.

Option 3:
To be able to call doStuff(), the client must be in role "user" or "customer"
This case may work in some EJB container as the deployment descriptor values augments the annotation values in the bean.


Related discussion about another similar question v6.2.603:
viewtopic.php?f=4&t=455&start=10