One-to-Many Relationships: Multi-Valued Properties

The SQL repository supports one-to-many relationships between two tables, and does not interpret the results according to any specific paradigm. This allows your application to apply whatever meaning you want to one-to-many relationships.

The SQL repository implements one-to-many relationships as multi-valued properties. To implement a multi-valued property, define the property with several <table> and <property> attributes:

<table> attributes

The <table> tag for a multi-valued property must set the following attributes:

Attribute

Set To:

type

multi

For example:

<table name="..." type="multi" ...

multi-column-name

The appropriate table column name. For example:

<table name="..." type="multi" multi-column-name="idx" ...

The multi-column-name attribute ensures that the ordering of the multi-values are maintained. The column specified by the multi-column-name attribute is used for multi-valued properties of data type array, map, and list and is not used for sets (which are unordered). For map type properties, the values in the column specifiedy by the multi-column-name attribute must be a string. For list or array type properties, these values should be an integer or numeric type, and must be sequential.

id-column-names

The appropriate table column names.

As with auxiliary tables, the ordering of the ID column names is important. The columns specified by This attribute must list table columns in the same order as the id-column-names attribute of the primary table.

<property> attributes

The <property> tag for a multi-valued property sets the following attributes:

Attribute

Set To:

data-type

One of the following:

arraysetmaplist

For example:

<property ... data-type="array" ...

component-data-type

A primitive data type such as int and string, or the name of a user-defined property type (see User-Defined Property Types). For example: