Enterprise JavaBeans:
– Server-side, modular, and reusable components that comprise specific units of functionality
– EJBs are found through Java Naming and Directory Interface (JNDI)
– Has certain restrictions
– Communicates via RMI over IIOP (Remote Method Invocation over Internet Inter-ORB Protocol)
3 types of EJBs:
– Session
– Entity
– Message-Driven
Entity Bean:
– Persistent until explicity deleted
– Identified by a primary key
– Can either be BMP (Bean Managed Persistence – programmer writes the persistence mechanism) or CMP (Container Managed Persistence – app server handles the persistence)
– Typically persisted by a database
Session Bean:
– Can be either stateful or stateless
– Does not have a primary key
Stateless Session Bean:
– Can be pooled
Stateful Session Bean:
– Maintains state information
– Generally used to maintain session when HttpSession is not available
EJB Interfaces:
– Remote – interface used by client outside the JVM of the EJB (uses RMI)
– RemoteHome – creates/gets the remote interface
– Local – interface used by client within the same JVM as the EJB (doesn’t use RMI)
– LocalHome – creates/gets the home interface
Usage:
– Most common EJB is stateless session bean
– Stateful session bean and entity beans are rarely used
Tutorials:
EJBTut
Sun EJB Tutorial
Getting started with EJB
Articles:
Stateful Session EJBs: Beasts of Burden
EJB 2.0 – Remote/Local
FAQ:
jGuru
Books:
Mastering EJB 2
EJB Design Patterns
Tools:
XDoclet