162 Patterns: Implementing Self-Service in an SOA Environment
Figure 7-8 Command hierarchy
7.2.8 Best practices for EJBs
The following is a brief collection of best practices for developers of Enterprise
JavaBeans:
򐂰 Use session beans to represent large-grained tasks in the business process.
Session beans are used by one client and may or may not have associated
properties.
򐂰 Use entity beans to represent fine-grained business domain elements.
Entity beans are shared by many clients and typically have persistent data.
«JavaInterfac
TargetableCommand
+ getC ommandTarget ( )
+ getC ommandTargetName (
)
+ hasOutputProperties ( )
+ performExecute ( )
+ setC ommandTarget ( )
+ setC ommandTargetName ( )
+ setOutputProperties ( )
TargetableCommandImpl
«JavaInterfac
CompensableCommand
+ getC ompensatingC ommand ( )
«Jav aInterface»
Serializable
«JavaInterfac
Command
+ execute ( )
+ isReadyToCallExecute (
)
+ reset ( )

Get Patterns: Implementing Self-Service in an SOA Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.