This example demonstrates the use of multi-column or composite repository IDs.

<item-descriptor name="typeX" id-separator=":">
  <table name="TYPEX" type="primary" id-column-names="TYPEX_ID">
    <property name="id" column-names="TYPEX_ID" data-type="string" />
    <property name="name" column-names="NAME" data-type="string" />
  </table>
  <table name="TYPEXY" type="multi" id-column-names="TYPEX_ID">
    <property name="typeXYs" component-item-type="typeXY"
              column-names="TYPEX_ID,TYPEY_ID" data-type="set" />
  </table>
</item-descriptor>

<item-descriptor name="typeY" id-separator=":">
  <table name="TYPEY" type="primary" id-column-names="TYPEY_ID">
    <property name="id" column-names="TYPEY_ID" data-type="string" />
    <property name="name" column-names="NAME" data-type="string" />
  </table>
</item-descriptor>

<item-descriptor name="typeZ" id-separator=":">
  <table name="TYPEZ" type="primary" id-column-names="TYPEZ_ID">
    <property name="id" column-names="TYPEZ_ID" data-type="string" />
    <property name="name" column-names="NAME" data-type="string" />
  </table>
</item-descriptor>

<item-descriptor name="typeXY" id-separator=":">
  <table name="TYPEXY" type="primary" id-column-names="TYPEX_ID,TYPEY_ID">
    <property name="id" column-names="TYPEX_ID,TYPEY_ID"
              data-types="string,string" />
    <property name="name" column-names="NAME" data-type="string" />
    <property name="x" column-names="TYPEX_ID" item-type="typeX" />
    <property name="y" column-names="TYPEY_ID" item-type="typeY" />
  </table>
  <table name="TYPEXYZ" type="multi" id-column-names="TYPEX_ID,TYPEY_ID">
    <property name="typeXYZs" component-item-type="typeXYZ"
              column-names="TYPEX_ID,TYPEY_ID,TYPEZ_ID" data-type="set" />
  </table>
</item-descriptor>

<item-descriptor name="typeXYZ" id-separator=":">
  <table name="TYPEXYZ" type="primary"
         id-column-names="TYPEX_ID,TYPEY_ID,TYPEZ_ID">
    <property name="id" column-names="TYPEX_ID,TYPEY_ID,TYPEZ_ID"
              data-types="string,string,string" />
    <property name="name" column-names="NAME" data-type="string" />
    <property name="x" column-names="TYPEX_ID" item-type="typeX" />
    <property name="y" column-names="TYPEY_ID" item-type="typeY" />
    <property name="z" column-names="TYPEZ_ID" item-type="typeZ" />
    <property name="xy" column-names="TYPEX_ID,TYPEY_ID" item-type="typeXY" />
  </table>
</item-descriptor>
SQL Statements
drop table TYPEXYZ;
drop table TYPEXY;
drop table TYPEZ;
drop table TYPEY;
drop table TYPEX;

CREATE TABLE TYPEX (
     TYPEX_ID          VARCHAR(32)     not null,
     NAME               VARCHAR(32)     null,
     primary key(TYPEX_ID)
);

CREATE TABLE TYPEY (
     TYPEY_ID          VARCHAR(32)     not null,
     NAME               VARCHAR(32)     null,
     primary key(TYPEY_ID)
);

CREATE TABLE TYPEZ (
     TYPEZ_ID          VARCHAR(32)     not null,
     NAME               VARCHAR(32)     null,
     primary key(TYPEZ_ID)
);

CREATE TABLE TYPEXY (
     TYPEX_ID                VARCHAR(32)     not null,
     TYPEY_ID                VARCHAR(32)     not null,
     NAME                    VARCHAR(32)     null,
     primary key(TYPEX_ID, TYPEY_ID),
     foreign key (TYPEX_ID) references TYPEX(TYPEX_ID),
     foreign key (TYPEY_ID) references TYPEY(TYPEY_ID)
);

CREATE TABLE TYPEXYZ(
     TYPEX_ID                VARCHAR(32)     not null,
     TYPEY_ID                VARCHAR(32)     not null,
     TYPEZ_ID                VARCHAR(32)     not null,
     NAME                    VARCHAR(32)     null,
     primary key(TYPEX_ID, TYPEY_ID,TYPEZ_ID),
     foreign key (TYPEX_ID) references TYPEX(TYPEX_ID),
     foreign key (TYPEY_ID) references TYPEY(TYPEY_ID),
     foreign key (TYPEZ_ID) references TYPEZ(TYPEZ_ID)
);
 
loading table of contents...