Skip to main content Skip to complementary content

Adding a foreign key: linking entities together

Talend Studio enables you to set relationship between different entities using Foreign Keys.

Before you begin

You have already created data models, business entities and attributes in the data model. For further information, see Creating a data model, Creating business entities in a data model and Adding attributes to the business entity.

About this task

Consider as an example that your data model hold the following entities: Agency, Agent and Region. You want to link the two entities Agency and Region together in order to represent that an Agency belongs to a Region. Consequently, Agency will have a new attribute that points to a Region.

To set a foreign key, do the following:


  1. Add a new Region attribute to the Agency entity as outlined in Adding attributes to the business entity.
  2. Right-click Region and select Set the Foreign Key from the list.
    Set the Foreign Key dialog box pops up.
  3. Click the three-dot button to open the Select Xpath dialog box.
  4. Browse to the Region primary key Id and then click Add in the bottom of the dialog box to proceed to the next step.
    The Xpath to the foreign key displays in the Set the Foreign Key dialog box.
  5. If you want to render the Foreign Key in the main tab, select the Render Foreign Key in the main tab? check box. By default, Talend MDM Web UI renders the Foreign Key in a separate tab.
  6. Click OK to close the dialog box.
    The foreign key is set to Region/Id under the Annotations node of the Region attribute in the data model editor.
    Entities which are linked by a foreign key are identified by a key icon with a green arrow . To jump directly to the related entity, right-click the entity in the data model editor and click Jump to Foreign Key Entity.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!