1 Interface (publishes methods to client ---how client accesses) + 1 Class (implmeents actual business logic...container invokes)
The obtain a reference to a remote business interface of an enterprise bean using JNDI lookup, use the javax.naming.InitialContext interface's lookup method.
ExampleRemote example = (ExampleRemote) InitialContext.lookup("java:global/myApp/ExampleRemote");
Uses special keywords to denote method invokation as related to lifecyle
Construction/Destroy methods@PostConstruct
@PreDestroy
|
Stateless/Not Stateless declarationdo annotation prior to Bean class @Stateless @Statefull
|
Remote/Local accessRemote Specification
Local Declaration (DEFAULT ---do not have to declare) --- use this only when the EJB will ONLY be accessed by local webapps or other EJB.
|
EJB Passivation
Passivate ----Method called before passivation happens --tag with this
Activate ----Method called afteractivation happens --tag with this
|
Many more annotation tags
MORE...... See Java website or http://puzzle.mcs.csueastbay.edu/docs/javaee-tutorial/doc/gijrb.html for some examples |
2 Interfaces + 1Class
(Note: Entity beans also have a primary key class.)
(Note: Message-driven beans MDBs only have a class, no interfaces)
package: javax.ejb
Home Interface |
Lists methods available for creating, removing and finding EJBs in the container.
|
|
|
||
Component Interface |
defines the methods offered by the bean class.
|
|
|
||
Bean Class |
has methods that implements business logic,etc.
|
|
|
Note: You can create "local interfaces" for your EJB when you can garauntee your client is running in the same JVM as your EJB. It will improve performance as you do not need to use RMI. This first introduced in EJB 2.0 specification.