©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Value List Handler

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

Problem

You have a remote client that wants to iterate over a large results list.

Forces

  • You want to avoid the overhead of using EJB finder methods for large searches.
  • You want to implement a read-only use-case that does not require a transaction.
  • You want to provide the clients with an efficient search and iterate mechanism over a large results set.
  • You want to maintain the search results on the server side.

Solution

Use a Value List Handler to search, cache the results, and allow the client to traverse and select items from the results.

Class Diagram

Sequence Diagram

Strategies

  • POJO Handler Strategy
  • Value List Handler Session Façade Strategy
  • Value List from Data Access Object Strategy

Consequences

  • Provides efficient alternative to EJB finders
  • Caches search results
  • Provides flexible search capabilities
  • Improves network performance
  • Allows deferring entity bean transactions
  • Promotes layering and separation of concerns
  • Creating a large list of Transfer Objects can be expensive

Related Patterns

  • Iterator [GoF]
    This Value List Handler uses the Iterator pattern, described in the GoF book, Design Patterns: Elements of Reusable Object-Oriented Software.
  • Data Access Object
    This Value List Handler uses the Data Access Object to perform searches using either the DAO Transfer Object Collection strategy to obtain a collection of transfer objects or using the DAO RowSet Wrapper List strategy to obtain a custom List implementation.
  • Session Façade
    The Value List Handler is often implemented as a specialized version of the Session Façade responsible for managing the search results and providing a remote interface. Some applications might have Session Façades that expose other business methods and also include the functionality of the Value List Handler. However, it might be better to keep the list handling functionality of the Value List Handler separate from the business methods of a Session Façade. Thus, if the Value List Handler needs a remote interface, provide a dedicated session bean implementation that encapsulates and facades the Value List Handler.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use