Compound key in Find and Reserve

book

Article ID: 211774

calendar_today

Updated On:

Products

CA Test Data Manager (Data Finder / Grid Tools)

Issue/Introduction

I'm building a simple Find & Reserve model using two tables. Those two tables are related via a compound key. When adding fields for the second table, we eventually need to choose the existing relationship. Here, I just want to validate the following points:
-I have to choose one and only one relationship to build the relationship inside the F&R model.
-The behavior might differ according to the chosen relationship

In the case of multiple relationships, is there a way to choose multiple relationships? Or, in a more general way, how can F&R treat compound keys inside a model?
 
https://community.broadcom.com/enterprisesoftware/communities/community-home/digestviewer/viewquestion?ContributedContentKey=6cd8b3de-4217-42db-952f-e5b501c1b9ad&CommunityKey=909e0526-d8ad-455d-97eb-aa009df5d3aa&tab=digestviewer#399b7d87-971d-4298-80cb-bf028cc8b4d0


Environment

Release : 4.9.1

Component : CA Test Data Manager - TDM Web Portal

Resolution

From the UI, we only support one of the composite keys. In this case, the query that is built in the backend will use the chosen relationship rather than the composite key when joining the two tables.

However you will be able to create a Find and Reserve model that uses the composite key by using swagger directly.

You should provide the whole composite key when creating the association


In my case I used department as root entity and ....


CREATE TABLE dbo.department
(
    id int NOT NULL,
    name nvarchar(50) NOT NULL,
    location nvarchar(50),

    CONSTRAINT PK_dbo_department_id_name
    PRIMARY KEY CLUSTERED (id,name)
);

CREATE TABLE dbo.person
(
    id int NOT NULL,
    name nvarchar(50) NOT NULL,
age int,

    dept_id int,
    dept_name nvarchar(50),

    CONSTRAINT PK_dbo_t2_id_name
    PRIMARY KEY CLUSTERED (id,name),

    CONSTRAINT FK_dbo_t2_t1_id_name
    FOREIGN KEY (dept_id, dept_name)
    REFERENCES dbo.department (id, name)
);

 

The request call 
http://localhost:8080/TDMDataReservationService/api/ca/v1/testDataModels/1132/associations?projectId=2358&versionId=2359&forceUpdate=false

 

had the following payload 
{
   "name":"person",
   "associationType":"ONE_ONE",
   "joinFields":[
      {
         "referenceFieldName":"dept_id",
         "fieldName":"id"
      },
      {
         "referenceFieldName":"dept_name",
         "fieldName":"name"
      }
   ],
   "sourceEntity":{
      "name":"department",
      "dataSource":"ds2",
      "schema":"dbo"
   },
   "targetEntity":{
      "name":"p

erson",
      "dataSource":"ds2",
      "schema":"dbo"
   },
   "dataModelId":1132,
   "projectId":2358,
   "versionId":2359
}

Is there a way to create more than one field at the time or one call = one field ?  One call - One field.