client updates the data in the business tier much less frequently than it reads the data. The sequence diagram in Figure.12 demonstrates this strategy. Chattier applications-those with increased traffic between client and server tiers-often degrade network performance. This information * is only obtained from the * class using reflection once, after that it will be * obtained from the classDataInfo HashMap. One strategy to use here is to update only attributes that have changed, rather than updating all attributes. The * given object must be an EJB Implementation and have * a superclass that acts as the class for the entity's * Transfer Object. Figure.11 Entity Inherits Transfer Object strategy class diagram The TransferObject implements one or more getData methods as discussed in the Multiple Transfer Objects Strategy. public static rializable createTransferObject(Object ejb, String whichTOType, String completeTOType) try / Get the class data for the complete / Transfer Object type ClassData cData getClassData (completeTOType / Get class data for the requested TO type ClassData voCData getClassData (whichTOType / Create the Transfer Object.
Figure.8 Updatable Transfer Object strategy - sequence diagram Multiple Transfer Objects Strategy Some application business objects can be very complex. The CustomerTO Transfer Object implements Customer, and the ContactTO Transfer Object implements Contact. To reduce the number of remote calls and to avoid the associated overhead, it is best to use Transfer Objects to transport the data from the enterprise bean to its client. Similarly, when the BusinessObject is implemented as a coarse-grained entity bean, typically applying the Composite Entity pattern, the entity bean will have complex relationships with a number of dependent objects. The BusinessEntity passes the required Transfer Object's class to the TransferObjectFactory, which creates a new Transfer Object of that given class. In this strategy, the business entity provides various methods to get different Transfer Objects. In this case, since there exists a one-to-one relationship between the entity bean and its Transfer Object, the entity bean may be able to use inheritance to avoid code duplication. Return cData; * Inner Class that contains class data for the * Transfer Object classes class ClassData / Transfer Object Class public Class clsTransferObject; / Transfer Object fields public eld arrFields; / Constructor public ClassData(Class cls, eld fields) clsTransferObject cls; arrFields code promo sur cartouche d'encre sur francetoner fields; Related Patterns Session.