In order to obtain the data of a repository item from a datatore, you must supply the ID that is maintained in the primary table. The repository item descriptor can map to the table’s ID column implicitly through its id-column-names
attribute; or it can explicitly map to it 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-name="emp_id"> <property name="id" column-name="product_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 set a different data type for the id
property. The columns specified by the id-column-names
attribute do not have to use the same data type as each other; you can have a composite repository ID the elements of which are strings, integers, and longs.
After a repository item is created, but before it is added to the database, you can change its repository ID by changing the value of the id
property. You cannot change a repository item’s ID after it is persistent.
Constraints
Avoid using the following special characters in repository IDs:
Characters used in: | Examples |
---|---|
URLs |
|
XML |
|