This example maps a repository item to a primary table and an auxiliary table (a one-to-one relationship).
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE gsa-template PUBLIC "-//Art Technology Group, Inc.//DTD Dynamo Security//EN" "http://www.atg.com/dtds/gsa/gsa_1.0.dtd"> <gsa-template> <header> <name>Repository Example Version B</name> <author>Pat Durante</author> <description> This template maps a repository item to a primary table and an auxiliary table (a one-to-one relationship.) Each user has a job title and function. </description> </header> <item-descriptor name="user" default="true"> <table name="usr_tbl" type="primary" id-column-names="id"> <property name="id" data-type="string"/> <property name="name" column-names="nam_col" data-type="string"/> <property name="age" column-names="age_col" data-type="int"/> </table> <table name="job_tbl" type="auxiliary" id-column-names="id"> <property name="function"/> <property name="title"/> </table> </item-descriptor> </gsa-template>
SQL Statements
drop table usr_tbl; drop table job_tbl; CREATE TABLE usr_tbl ( id VARCHAR(32) not null, nam_col VARCHAR(32) null, age_col INTEGER null, primary key(id) ); CREATE TABLE job_tbl ( id VARCHAR(32) not null references usr_tbl(id), function VARCHAR(32) null, title VARCHAR(32) null, primary key(id) );