Avatar

Level 2

Hi Experts,

 

If I understand correctly, if we declare a key in adobe data schema, it creates an unique index with not null constraint enforced in the backend table (not exactly an Oracle primary key).

I'm trying to implement Primary-Foreign key relation in ACM. I've declared a link between the tables (code below).
However, it doesn't enforce this in backend database (parent-child validations don't take place).
Sample code below:

Scenario: Parent table (test1) & child table (test2). Sample below:

test1:

<element label="test1" name="test1">

   <key internal="true" name="PKEY_t1">
     <keyfield xpath="@col1"/>
   </key>

   <attribute label="col1" name="col1" type="long"/>
   <attribute label="col2" name="col2" type="string"/>
   <attribute label="col3" name="col3" type="string"/>
</element>

test_1.JPG

 

 

test2:

<element label="test2" name="test2">

   <key internal="true" name="PKEY_t2">
     <keyfield xpath="@col1"/>
   </key>

   <attribute label="col1" name="col1" type="long"/>
   <attribute label="col2" name="col2" type="long"/>
   <attribute label="col3" name="col3" type="string"/>

   <element label="test_link" name="test_link" target="pl_:test1" type="link">
   <join xpath-dst="@col1" xpath-src="@col2"/>
   </element>

</element>

test_2.JPG

 

Please suggest.