212014Aug

Component-item-type and Item-type in ATG

Component-item-type and Item-type

Both these attributes are use to link table column to other repository item. The difference is

Component-item-type – When you are using one-to-many mapping and you are referring to other repository items i.e another item descriptor.

e.g Album and Song are two different item-descriptor. An album can have multiple songs so there is one-to-many relationship here. So here component-item-type will be used like this.

.
.

<property name="songs" column-name="song_id" data-type="set" component-item-type="song" />

.
.

Here property name is songs which is map to another item descriptor song and data-type=”set” is use for storing multiple values.

Item-type – When you are using one-to-one mapping and you are referring to other repository items i.e another item descriptor.

e.g Album and Cover Pic are two different item-descriptor. An album can have only one cover pic so there is one-to-one relationship here. So here item-type will be used like this.

.
.

<property name="coverpic" column-name="pic_id" item-type="coverpic" />

.
.

Note :- With item-type no data-type is used as item-type is itself a data-type of other repository item.