Creating your own ATG Repository - Beginners- II

We will be covering the Auxiliary Table and One to One relation in between same repository.

Auxiliary Table contains the part of details from Item-descriptor. Auxiliary tables help to distribute and group the data away from Primary Table.

Must read Points:
1. Auxiliary table's id-column-name should be same as that Primary Table.
2. Auxiliary table has to defined within scope of Same <item-descriptor>
3. For referencing the use item-type and refer to <item-descriptor> of referenced item.
4. item-type takes place of data-type.




Step 1: Analyse the additional columns and group them accordingly into auxiliary tables.



In above diagram, we can group Book's dimensions into one group and Author into another group. So we will create  two auxiliary tables. And in second table we will refer to Author item-descriptor.


Step 2: Modify the library.xml and add  two auxiliary tables.

<item-descriptor name="book" display-name="book" >
   
    <table name="BOOK_MASTER" type="primary" id-column-name="book_id">      

........................
    </table>

  <table name="BOOK_DIMENSION" type="auxiliary" id-column-name="book_id">
       <property name="length" column-name="length" display-name="length" data-type="double"/>
       <property name="width" column-name="width" display-name="width" data-type="double"/>
       <property name="height" column-name="height" display-name="height" data-type="double"/>
       <property name="weight" column-name="weight" display-name="weight" data-type="double"/>
</table>

<table name="BOOK_AUTHOR" type="auxiliary" id-column-name="book_id">
    <property name="author" column-name="author" display-name="author" item-type="author"/>
</table>
</item-descriptor>


In BOOK_AUTHOR, Property "author" is being referred to "author" item-descriptor.

2 comments: