Can ItemDescriptor be mapped to a view instead of table

96 Views Asked by At

i have a view and it will be much easier for me to work against a view instead of a table itself. In ATG, can i map an itemdescriptor to a view instead of a table? Can someone provide me with an example?

TIA

1

There are 1 best solutions below

0
On BEST ANSWER

Yes it can. It is actually no different to setting up a normal item-descriptor. However most views are read-only so you need to make sure your item-descriptor is also read-only. This can be achieved by setting the writable="false" property on the item-descriptor definition. The name of the view simply becomes the name of the table.

<item-descriptor name="ExampleItemDescriptor" cache-mode="simple" writable="false" query-expire-timeout="60000" item-cache-timeout="60000" item-cache-size="2000" query-cache-size="2000">
    <table name="name_of_view" type="primary" id-column-names="multiple,columns">
        <property name="aproperty" column-name="column" data-type="string" />
    </table>
</item-descriptor>