Customizing data beans

A data bean normally extends an access bean. The access bean, which can be generated by Rational Application Developer, provides a simple way to access information from an entity bean. When modifications are made to an entity bean (for example, adding a new field, a new business method or a new finder), the update is reflected in the access bean as soon as the access bean is regenerated. Since the data bean extends the access bean, it automatically inherits the new attributes. As a result of this relationship, no coding is required to enable the data bean to use new attributes from the entity bean.

If add new attributes to a data bean that are not derived from an entity bean, you can extend the existing data bean using Java inheritance. For example, if you want to add a new field to the OrderDataBean, define MyOrderDataBean as follows:

public class MyOrderDataBean extends OrderDataBean
{
     public String myNewField () {
     //  implement the new field here
     }

}

For more information see Adding a finder to an existing entity bean tutorial that describes extending the Orders data bean.

Related concepts

WebSphere Commerce data beans