The SQL repository lets you filter database read operations. For example, you might want a database lookup always to return only items whose activeFlag
property is true
. You can filter the repository by defining a repository query that specifies the filter criteria you want and associating it with the appropriate item descriptor. The filter is automatically applied to all of the following operations:
Repository.getItem()
Repository.getItems()
MutableRepository.getItemForUpdate()
MutableRepository.getItemsForUpdate()
RepositoryView.executeQuery()
RepositoryView.executeCountQuery()
You can define a repository filter in three ways:
Use the
<rql-filter>
tag in the definition file for an item descriptor.Set the
filterQuery
property of the item descriptor to a Query object.Set the
rqlFilterString
property of the item descriptor to an RQL string, which is compiled into the Query object that defines the filter.
In most cases, the first method, using the <rql-filter>
tag, is easiest and preferable.