Java Reference
In-Depth Information
To opt out of passivation, set the passivationCapable attribute of the @Stateful annotation to false , as
demonstrated in the following excerpt:
public class AcmeFacade {
Explicitly Denoting Local and Remote Business Interfaces
The release of EJB 3.0 greatly simplified development with EJBs because it introduced the no-interface view for
making local business interfaces optional. The no-interface view automatically exposes all public methods of a
bean to the caller. By default, a no-interface view is automatically exposed by any session bean that does not include
an implements clause and has no local or remote client views defined. The EJB 3.2 release aims to provide further
granularity for those situations where local and remote interfaces need to be explicitly specified.
A business interface cannot be made both the local and remote business interfaces for a bean. Therefore, a new
API has been developed to specify whether a business interface is intended as local or remote. The following rules
pertain to business interfaces implemented by enterprise bean classes:
The interface, the interface, and interfaces
defined by the javax.ejb package are always excluded when the determination of local or
remote business interfaces are declared for a bean.
If a bean class contains the
@Remote annotation, then all implemented interfaces are assumed
to be remote.
If a bean class contains no annotation or if the
@Local annotation is specified, then all
implemented interfaces are assumed to be local.
Any business interface that is explicitly defined for a bean that contains the no-interface view
must be designated as @Local .
Any business interface must be explicitly designated as local or remote if the bean class
explicitly specifies the @Local or @Remote annotation with a nonempty value.
Any business interface must be explicitly designated as local or remote if the deployment
descriptor specifies as such.
Let's break down these rules a bit so that they are easier to understand. First, if an EJB exposes local interfaces,
then there is no need to explicitly denote a bean as such. For instance, the following bean contains a local interface,
although it is not explicitly denoted:
public class AcmeSession implements interfaceA {
public interfaceA { ... }
Search WWH ::

Custom Search