Using the Sun Data Mashup Engine

ProcedureTo Add a Join

Before You Begin

Before creating a join, you must have a virtual database, Data Mashup project, the NetBeans IDE must be running, and you must be connected to the virtual database.

  1. If necessary, connect to the virtual database.

    1. In the NetBeans IDE, select the Services tab and expand the Databases.

    2. Right-click the database you want to start and select Connect.

      In this procedure, start VirtualMashupDB_1222123456789.

  2. In the NetBeans IDE Project tree, expand your Data Mashup project.

    Under the default package you should see the Data Mashup file you created when creating a Data Mashup project, demoDMfile.edm (see Designing Data Mashup Projects).


    Note –

    demoDMfile.edm also appears as a tab in the center pane.


  3. In the NetBeans IDE center pane, double-click demoDMfile.edm to open the NetBeans IDE Canvas.

  4. Add the tables you want to join to the canvas.

    1. In the EDM Editor tool bar click the Add Table icon.


      Note –

      If the Projects tab covers some of the tools available for use with the canvas, and you do not see the Add Table icon, click the Projects tab to close the pane or click the Restore Window icon on the canvas tool bar.


    2. In the Select Source Table window, select the database.

      In this procedure, use VirtualMashupDB_1222123456789. After selecting the database, the tables you added to it appear in the Tables area on the right side of the window. You are using the SUPPLIER_ADDRESS and COMPANY_DATA tables.

    3. Highlight the tables and click Select.

      Repeat this step if necessary to add both tables to the Table Selection area.

    4. Click OK.

      The window closes and the tables, along with Runtime Input, appear on the canvas. You are now ready to create the join.

  5. From the Table Operators palette, drag the Join operator onto the canvas.

    You are now ready to merge your tables into one table. In the example you are going to merge SUPPLIER_ADDRESS and COMPANY_DATA.

  6. In the Create New Join View window, click All> to move the tables to the Selected Tables list.

    In the example, both tables appear in the Preview area and are linked to the join. You can edit the join types using the drop-down dialog.

    Inner

    Returns only the records in the selected tables that match. For this example, retain this default.

    Left Outer

    Returns all records in the left table regardless if there are any matches with the right table. When there is no matching in the right table, NULL fills in the field.

    Right Outer

    Returns all records in the right table regardless if there are any matches with the left table. When there is no matching in the left table, NULL fills in the field.

    Full Outer

    Returns the all records from the left and right tables in the merged table. All fields that do not match are filled with NULL.

  7. Click OK.

    The root join is added to the canvas and is linked to the two tables.