Suppose an EJB named HelloWorldBean is deployed as a standalone ejb-jar. Assuming the
HelloWorldBean is implemented as follows:
Which HelloWorldBean methods are accessible by another EJB within the same ejb-jar?
A.
All of the methods declared in HelloWorldBean
B.
All of the methods declared in HelloWorld and HelloWorldBean
C.
All of the public methods declared in HelloWorldBean
D.
All of the public methods declared in HelloWorld andall of the methods declared in
HelloWorldBean
D
I think it’s C. All public methods declared in HelloWorldBean (as no-interface view)
Methods of the HelloWorld interface cannot be exposed as business interface (assuming it doesn’t declare @Local or @Remote) as there is a No-Interface View.
Even if something of this was declared, only public methods of HelloWorld should be exposed.
From JSR318 – Enterprise JavaBeans 3.1, Final Release
4.9.6 Business Methods
The business method must be declared as public.
4.9.7 Session Bean’s Business Interface
If the bean does not expose any other business interfaces (Local, Remote) or No-Interface view, and the bean class implements a single interface, that interface is assumed to be the business interface of the bean. This business interface will be a local interface unless the interface is designated as a remote business interface by use of the Remote annotation on the bean class or interface or by means of the deployment descriptor.
4.9.8 Session Bean’s No-Interface View
If the bean exposes at least one other client view, the bean designates that it exposes a
no-interface view by means of the @LocalBean annotation on the bean class or in
the deployment descriptor.
All public methods of the bean class and any superclasses are exposed as business methods
through the no-interface view