The user
item type demonstrates a variety of data relationships. It shows how an item type can use properties that nest other item types. The user
item descriptor is defined as follows:
<item-descriptor name="user" default="true"> <table name="rlex_user" type="primary" id-column-name="id"> <property name="id" data-type="string"/> <property name="name" column-name="nam_col" data-type="string"/> <property name="age" column-name="age_col" data-type="string"/> </table> <!-- a set of address items --> <table name="rlex_address" type="multi" id-column-name="user_id"> <property name="addresses" column-name="addr_id" data-type="set" component-item-type="address" cascade="delete,update"/> </table> <!-- a set of contact items --> <table name="rlex_contact" type="multi" id-column-name="user_id"> <property name="contacts" column-name="con_id" data-type="set" component-item-type="contact" cascade="delete,update"/> </table> <!-- a map of phone items --> <table name="rlex_phone" type="multi" id-column-name="user_id" multi-column-name="kind"> <property name="numbers" column-name="phone_id" data-type="map" component-item-type="phone" cascade="delete,update"/> </table> <!-- a one-to-one mapping in an aux table --> <table name="rlex_job" type="auxiliary" id-column-names="id"> <property name="jobtype"/> <property name="title"/> </table> <!-- a multivalue property (array) --> <table name="rlex_subjects" type="multi" id-column-names="id" multi-column-name="seq_num"> <property name="favoriteSubjects" column-names="subject" data-type="array" component-data-type="string"/> </table> <!-- a multivalue property (list) --> <table name="rlex_worst" type="multi" id-column-names="id" multi-column-name="seq_num"> <property name="worstSubjects" column-names="subject" data-type="list" component-data-type="string"/> </table> <!-- a multivalue property (map) --> <table name="rlex_credit_card" type="multi" id-column-names="id" multi-column-name="card_key"> <property name="card_num" column-names="card_num" data-type="map" component-data-type="string"/> </table> </item-descriptor>
The user
item type defines three string properties, id
, name
, and age
, in its primary table. Contact information about the user is defined in three multi-valued properties, addresses
, contacts
, and numbers
. The values of each of these multi-valued properties are collections of other repository items (address
, contact
, and phone
, respectively).
In addition, the user
item type defines the following properties:
| String properties, using a one-to-one mapping in an auxiliary table. |
| Multi-valued collections of strings properties, using a one-to-many mapping in a multi table. |