Configuring Publish by Reference Object

When source data is stored in a view or a different database object, you can publish the data by using a referred object. Publish by Reference Object is an extension of the Publish by Reference feature.

For a description of the Publish by Reference mode, see "Publish by Reference" in Selecting a Storage Mode.

In both cases, only key values from the source table are stored in the publishing table. However, publishing by reference object is used when a row changes in the source table and the associated trigger fires, the adapter fetches data from the referred object, rather than the source table. The name of the referred object is stored in the ADB_REF_OBJECT column in the publishing table. For a description of this column, see Publishing Table.

For best results use Publish by Reference Object when a view provides the most efficient access to source data, for example, when many levels of nesting exist between a parent table and a child table.

To use Publish by Reference Object, complete the following tasks:
  1. Specifying a Referred Object
  2. Changing Repository Objects for Parent-Child Table Relationships

Publishing a Message with a Referred Object

In the following example, the publisher adapter is configured to publish source data from the CUSTOMER table and its child table, EXTERNAL_ORDER_DETAILS. The relevant key columns are CUST_ID and ORDER_ID.

The publishing table is created with necessary adapter columns, as well as the CUST_ID and ORDER_ID columns. When a row in the CUSTOMER table is modified, the trigger fires, populating columns and copying the CUST_ID and ORDER_ID values, as well as the name of the referred object, ORDER_VIEW, to the publishing table. When the adapter polls the publishing table, it detects the new row. The adapter then selects the order and customer data from the referred object, ORDER_VIEW, using the CUST_ID and ORDER_ID values along with the view name found in the publishing table. Then the message is published.

Table to Record Sequence Numbers (DB2 on iSeries)

The palette attempts to create a table (if it does not exist) to record sequence numbers.

A table is created by using the following statement:

CREATE TABLE library.ADB_SEQTAB (
   PUB_TABLE VARCHAR(64)  NOT NULL,
      ADB_SEQ NUMERIC(20),
      constraint ADB.ADB_SEQTAB_KEY primary key (PUB_TABLE))

The table must be journalled.

You can create this table manually. If journalling is automatically turned on, the palette creates the table automatically.