# Substituting Extended Associations

Substituting an extended association allows any changes made to the original association, such as code added to the association's XML file or new source and destination objects, to be made available to all of its instances in the rest of the application. If you substitute the extended association, then you must ensure that the extended Entity Objects it connects are also substituted. This is because the extended Entity Objects will typically have new attributes that do not exist in the originals. Also, the the association might use these new attributes in its definition of the source and destination role attributes.

Figure 1: Substituting an Extended Association

As Figure 1 illustrates, assume that when you extended the `Emp` Entity, you added a `Loc` (location) attribute. Then when you create the extended association between `NewEmpEx` and `NewDeptEx` you can add `Loc` to the lists of source and destination role attributes. If you then substitute the extended association into the application, you must also substitute `NewEmpEx` (because `Emp` does not have a `Loc` attribute) and `NewDeptEx` (because `Dept` does not recognize `Loc` as a source role attribute).

## Using JDeveloper to Substitute Extended Associations

Use the Substitutions panel of the Business Components Project wizard to substitute the extended association throughout your application. For the procedure to substitute an association, see To Substitute Business Components. The framework makes an addition to the `Substitutes` section of the project's `.jpx` file which identifies the name of the original association and the name of the extended association that should be used instead.

For example, if you use the Substitutions panel of the Business Components Project wizard to substitute the extended association `NewFKAsocEx` for the original association `EmpForeignKeyAssoc` throughout your application, the framework adds a line to the `Substitutes` section of the project's XML file. A portion of the project's XML file is included below:

       ...
    <Substitutes>
          <Substitute OldName ="package27.Emp" NewName ="Extender.NewEmpEx" />
          <Substitute OldName ="package27.EmpForeignKeyAssoc" NewName ="Extender.NewFKAssocEx" />
          <Substitute OldName ="package27.Dept" NewName ="Extender.NewDeptEx" />
    </Substitutes>
       ...

Note that it is assumed that you have already substituted the extended Entity Objects `NewEmpEx` and `NewDeptEx` for the original Entities `Emp` and `Dept` in the project file.