A repository ID can be represented by a single column in the database, with a corresponding Java type of String, Integer, or Long. A repository ID may also be represented by more than one column in the database, each column of which can be either String, Integer, or Long. This type of repository ID is referred to as a multi-column ID or composite key ID.

A single property can be used to represent a single column of a multi-column ID or might represent all of the ID columns. So, both of the following are valid:

<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>
<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>

Both single-column repository IDs and multi-column repository IDs are encoded as strings. By default, a multi-column ID is encoded by concatenating the ID’s elements, in the order specified by the item descriptor’s id-column-names attribute, with each element separated by a separator character. By default, this separator character is the colon (:). You can specify a different separator character using the item descriptor’s id-separator attribute. For example, in an item descriptor defined like this:

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

you might have repository IDs that are string-encoded like this:

sales*bbanzai

You should not use brackets or commas for the separator character, since these characters are used by RQL and the SQL repository when specifying lists of IDs.

 
loading table of contents...