How to resolve validation error "Publishing table [P_TableName] has no primary keys. Cannot choose [Publish by Reference] for [TableName] DBPoller Schema"

How to resolve validation error "Publishing table [P_TableName] has no primary keys. Cannot choose [Publish by Reference] for [TableName] DBPoller Schema"

book

Article ID: KB0076796

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for Database 8.x

Description

While configuring adbResource in ActiveMatrix BusinessWorks Plug-in for Database 8.x user might get a validation error stating that "Publishing table [P_TableName] has no primary keys. Cannot choose [Publish by Reference] for [TableName] DBPoller Schema".

The error can come up when below conditions are met:
1. The source table is not having primary key constraint in the schema(Adding the primary key to the existing table is not always possible)
2. "Publish by Reference" storage mode is selected.

Issue/Introduction

How to resolve validation error "Publishing table [P_TableName] has no primary keys. Cannot choose [Publish by Reference] for [TableName] DBPoller Schema"

Environment

Product: TIBCO ActiveMatrix BusinessWorks Plug-in for Database Version: 8.x OS: All

Resolution

Source table without primary key constraint can be supported by the runtime component but the plugin code(unlike adapter code) has Primary Key requirement for design time for the trigger generation.

Please follow below steps as a workaround for this issue:
1) Create a table with one or more column(s) as the primary key, and configure adb poller activty against this source table. Make sure not to apply the trigger. 
2) Manually create the Publishing table(P_table) and the mutex table using the generated sql script; drop the source table; and create the source table without the primary key; manually modify the trigger to remove the primary key constraint in the update triggers and create the triggers onto the new source table with no primary key. 

e.g.
>>>>>>>
For MSSQL environment, below key update constraint entry needs to be removed from the update trigger:
=====================
IF UPDATE (id) BEGIN
RAISERROR ('ActiveDB Error: cannot update key fields of source table.', 16, 1)
ROLLBACK
END
====================
For modifications in the trigger generated using Oracle database, please refer the attachments and compare the trigger files pre and post modifications.
<<<<<<<<
3) Run the poller activity against the new db setting.

Attachments

How to resolve validation error "Publishing table [P_TableName] has no primary keys. Cannot choose [Publish by Reference] for [TableName] DBPoller Schema" get_app
How to resolve validation error "Publishing table [P_TableName] has no primary keys. Cannot choose [Publish by Reference] for [TableName] DBPoller Schema" get_app