A repository ID can span multiple database columns, where the data type of each column corresponds to the Java type String, Integer, or Long. An item descriptor can define one property that combines the data from all database ID columns, or define a property for each database ID column. The two examples that follow show how two database ID columns, folder_id and doc_id, can be specified by one item descriptor property, and by two properties.

Here, the ID property combines the data from the two database ID columns:

<table name="doc" type="primary" id-column-names="folder_id,doc_id">
  <property name="ID" column-names="folder_id,doc_id"
        data-types="string,int"/>
</table>

Here, two properties, folder and document, are defined to represent both database ID columns:

<table name="doc" type="primary" id-column-names="folder_id,doc_id">
  <property name="folder" column-names="folder_id" data-type="string"/>
  <property name="document" column-names="doc_id" data-type="int"/>
</table>
Concatentation of Multi-Column IDs

By default, a multi-column ID is encoded as a String that concatenates ID elements in the order specified by the item descriptor’s id-column-names attribute. Each element is separated by a separator character—by default, colon (:).

The item descriptor’s id-separator attribute can specify a different separator character. For example, an item descriptor might define its ID separator character as an asterisk (*):

<item-descriptor name="employee" id-separator="*">
  <table name="user" type="primary" id-column-names="dept_id,emp_id">
    properties...
  </table>
</item-descriptor>

In this case, the repository ID for a user item might look like this:

sales*bbanzai

The following constraints apply to multi-column ID separator characters:

Accessing Items with Compound Repository IDs

In order to retrieve or remove an item that uses a compound repository ID, you can supply the concatenated string ID as a parameter to atg.adapter.gsa.GSARepository methods such as getItems().

For example, given the following item descriptor:

<item-descriptor name="employees">
  <table name="employee_table" type="primary" id-column-names="dept_id,emp_id">
    <property name="id" column-names="dept_id,emp_id" data-types="string,int"/>
  </table>
</item-descriptor>

You might obtain an employee repository item as follows:

RepositoryItem employee = rep.getItems("IS:100002", "employee");