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.

About this task

To add 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, to add a field to the OrderDataBean, define MyOrderDataBean as shown in the following example:
public class MyOrderDataBean extends OrderDataBean
     public String myNewField () {
     //  implement the new field here