Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0) Part Number B28221-02 |
|
|
View PDF |
By associating an EJB 3.0 stateless session bean with EJB 2.1 home and component interfaces (see "Using Annotations"), you can adapt an EJB 3.0 stateless session bean so that an EJB 2.1 client can access it.
You can use this technique to manage the incremental migration of an EJB 2.1 application to EJB 3.0 or to give existing EJB 2.1 clients access to new development that you implement using EJB 3.0.
For more information on EJB 2.1 home and component interfaces, see the following:
To adapt an EJB 3.0 stateless session bean for an EJB 2.1 client, do the following:
Associate the EJB 2.1 home interfaces with the EJB 3.0 stateless session bean.
Use the @RemoteHome
annotation for remote home interfaces, and the @LocalHome
annotation for local home interfaces:
@Stateless @RemoteHome (value=Ejb21RemoteHome1.class) @LocalHome (value=Ejb21LocalHome.class) public class MyStatelessSB { ... }
Note:
You may associate a stateless session bean with at most one remote and one local home interface.Consider the requirements for supporting the home interface's create
methods.
An EJB 3.0 stateless session bean does not require an ejbCreate
method, even when it has a home interface. Alternatively, you may define a post-construct life cycle callback method (see "Configuring a Life Cycle Callback Interceptor Method on an EJB 3.0 Session Bean").
Associate the EJB 2.1 component interfaces with the EJB 3.0 stateless session bean.
Use the @Remote
annotation for remote component interfaces, and the @Local
annotation for local component interfaces:
@Stateless @Remote (value={Ejb21Remote1.class, Ejb21Remote2.class}) @Local (value={Ejb21Local.class}) public class MyStatelessSB { ... }
Note:
You may associate a stateless session bean with one or more remote and local component interfaces.