©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Transfer Object

See Core J2EE Patterns, 2nd Edition for full description of this pattern and its strategies.

Problem

You want to transfer multiple data elements over a tier.

Forces

  • You want clients to access components in other tiers to retrieve and update data.
  • You want to reduce remote requests across the network.
  • You want to avoid network performance degradation caused by chattier applications that have high network traffic.

Solution

Use a Transfer Object to carry multiple data elements across a tier.

Class Diagram

Sequence Diagram

Strategies

  • Updatable Transfer Objects Strategy
  • Multiple Transfer Objects Strategy
  • Entity Inherits Transfer Object Strategy

Consequences

  • Reduces network traffic
  • Simplifies remote object and remote interface
  • Transfers more data in fewer remote calls
  • Reduces code duplication
  • Introduces stale transfer objects
  • Increases complexity due to synchronization and version control

Related Patterns

  • Session Façade
    The Session Façade frequently uses Transfer Objects as an exchange mechanism with participating Business Objects. When the facade acts as a proxy to the underlying business service, the Transfer Object obtained from the Business Objects can be passed to the client.
  • Transfer Object Assembler
    The Transfer Object Assembler builds composite Transfer Objects from different data sources. The data sources are usually session beans or entity beans whose clients ask for data, and who would then provide their data to the Transfer Object Assembler as Transfer Objects. These Transfer Objects are considered to be parts of the composite object assembled by the Transfer Object Assembler.
  • Value List Handler
    The Value List Handler is another pattern that provides lists of dynamically constructed Transfer Objects by accessing the persistent store at request time.
  • Composite Entity
    The Transfer Object pattern addresses transferring data across tiers. This is one aspect of the design considerations for entity beans that can use the Transfer Object to carry data to and from the entity beans.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use