Best practices for developing enterprise beans
Use the following guidelines when designing and developing enterprise beans:
- Use a stateless session bean to act as the entry point for business logic. For more information about using session facades, see "Resources for learning."
- Entity beans should use container-managed persistence.
- In an EJB V2.x environment, use local interfaces to improve communication between enterprise beans in the same Java virtual machine.
Local calls avoid the overhead of RMI/IIOP and use pass-by-reference semantics instead of pass-by-value. For each call, the caller and callee beans share the state of arguments. EJB 2.x beans can have both a local and remote interface but more typically have one or the other.
- For communicating with remote clients, provide remote and remote home interfaces. For communicating with local clients like servlets, entity beans, and message-driven beans, provide local and local home interfaces.
See also
Batch commands for container managed persistence
Deferred Create for container managed persistence
Explicit invalidation in the Persistence Manager cache
Related Tasks
Task overview: Using enterprise beans in applications
See Also
Enterprise beans: Resources for learning