title: When to use access beans or data beans in Websphere Commerce?
body: <p>When is it appropriate to use a data bean or access bean in Websphere? Apologies if I'm asking basic questions, I'm new to Websphere.</p>
  
  <p>In my case, I'm trying to find a list of catalogues by product. Initially I've been using the access bean. This works, but it sometimes returns very large result sets / seems very memory intensive.</p>
  
  <pre><code>CatalogEntryDescriptionAccessBean cedabp = new CatalogEntryDescriptionAccessBean();
  Enumeration cde = cedabp.findByCatalogEntry(productCatIdLong);
  </code></pre>
  
  <p>The data bean provides the same method:</p>
  
  <pre><code>CatalogEntryDescriptionDataBean cedabp = new CatalogEntryDescriptionDataBean();
  Enumeration cde = cedabp.findByCatalogEntry(productCatIdLong);
  </code></pre>
  
  <p>Why would I use one bean over the other? Is one more appropriate for reading or writing data? Is the data provided by one cached / more current than the other?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I found that the two classes have the following relationship:</p>
  
  <pre><code>CatalogEntryDescriptionAccessBean
  |_ CachedCatalogEntryDescriptionAccessBean
    |_ CompactCatalogEntryDescriptionAccessBean
      |_ CatalogEntryDescriptionDataBeanBase
        |_ CatalogEntryDescriptionDataBean
  </code></pre>
  
  <p>So the Data Bean inherits from the Access Bean, hence why it contains the same visible methods.</p>
  
  <p>Interestingly, IBM's documentation states:</p>
  
  <blockquote>
    <p>Access beans provide ... caching of the
    home object, and reduced call traffic to the enterprise bean. Using access beans has additional
    advantages:</p>
    
    <p>At run time the access bean caches the enterprise bean home object
    because look ups to the home object are expensive, in terms of time
    and resource usage. The access bean implements a copyHelper object
    that reduces the number of calls to the enterprise bean when commands
    get and set enterprise bean attributes. Only a single call to the
    enterprise bean is required when reading or writing multiple
    enterprise bean attributes.</p>
  </blockquote>
  
  <p>At the moment, I'm confused about what purpose the Data Bean serves, if the Access Bean is using CMP to reduce calls to the Entity Bean?</p>
  
  <p>I've found some more documentation that states:</p>
  
  <blockquote>
    <p>A data bean is a Java bean that is used in JSP pages to retrieve
    information from the enterprise bean. A simple data bean extends its
    corresponding access bean and implements the SmartDataBean interface.
    By extending an access bean, the data bean provides a simple
    representation (indirectly) of an entity bean: it encapsulates the
    properties that can be retrieved from or set within the entity bean.</p>
  </blockquote>