A repository ID can be represented by a single column in the database, with a corresponding Java type of String
, Integer
, or Long
. A multi-column repository ID is represented by more than one database column, where each column can be String
, Integer
, or Long
.
A table can define one property that combines the data from all database ID columns, or define a property for each database ID column, as shown in the following examples.
Single column:
The ID
property combines the data from two database ID columns, folder_id
and doc_id
:
<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>
Double column:
The folder
property represents the folder_id
column, while the document
property represents the doc_id
:
<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>
Single-column 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, where each element is separated by a separator character. The default separator character is colon (:
). You can specify a different separator character with the item descriptor’s id-separator
attribute. For example, an item descriptor might define its ID separator character as an asterisk (*):
<item-descriptor name="user" 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
Separator character constraints
The following constraints apply to multi-column ID separator characters:
Do not use brackets or comma as separator character. These characters are used by RQL and the SQL repository when specifying lists of IDs.
Repository IDs in both columns must exclude the ID separator—by default, colon (:).