cancel
Showing results for 
Search instead for 
Did you mean: 

Foreign Keys in HDBDD files

0 Kudos

Hi,

I am trying to create a data model using HDBDD. I am trying to incorporate foreign keys where the referencing table should not allow an entry if the foreign key is not present in the referenced table.

@Schema : 'TEST

context STATUS_ENTRIES

{

     @Catalog.tableType : #COLUMN

      entity status

     {

           key status_id : Integer;

           description: String(10);

      } ;

      entity ref_status

      {

            key  ref_status_id: Association [1,1] to status{status_id};

            description: String(10);    

     };

};

So what i am trying to do here is to create a table named status which has the main status entries with key field as status_id and another table whose key ref_status_id is referencing status_id from status table. However when i insert ref_status id's in the "ref_status" table that are not present as status_id's in "status" table, it lets the query run successfully. Can someone let me know what i'm doing wrong?

Thanks,

Timothy

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Timothy,

The reason why you can insert "ref_status" successfully is that although the association means "foreign key" in HDBDD, the activation of HDBDD will not generate the real "foreign key" in database. You can check that with

SELECT * FROM REFERENTIAL_CONSTRAINTS;

to select all foreign keys in your database. However, you cannot find it related with your scenario. I also don't know how to generate the real "foreign key" when using association in HDBDD.

Best regards,

Wenjun

0 Kudos

Hi Wenjun,

Thanks for the reply. Turns out constraints are not supported in HDBDD yet. So we will have to wait for the feature to come.

Regards,

Timothy