In order to obtain the data of a repository item from a datastore, you must supply the primary table’s ID. The repository item descriptor can map to the table’s ID column implicitly through the <table>
tag attribute id-column-names
; or it can explicitly map to the ID column through a <property>
tag that is set as follows:
<property name="id" column-name="
table-id-column
"/>
For example:
<item-descriptor name="user"> <table name="user" type="primary" id-column-names="emp_id"> <property name="id" column-name="emp_id"/> </table> </item-descriptor>
If the item descriptor does not explicitly define an id
property, its data type cannot be explicitly set; and it uses the default string
data type. In this case, the following constraints apply:
You cannot query against repository item IDs.
You cannot access the item’s ID by calling
getPropertyValue()
; it is, however, accessible throughgetRepositoryId()
.
However, if you explicitly define the id
property in the item descriptor with a <property>
tag, you can query repository items by their ID and you can explicitly set the id
property’s data type. The columns specified by the id-column-names
attribute are not required to use the same data type; a composite repository ID can be composed of strings, integers, and longs.
Note: You cannot change a repository item’s ID after it is saved to the database.
Constraints
Avoid using the following special characters in repository IDs:
Characters used in: | Examples |
---|---|
URLs |
|
XML |
|