How to define the Hybris data model in items.xml?

Items.xml file contains the type definition in hybris. we can add a new item type or update the existing one but the order of type or sequence is important otherwise build will be failed and item.xml is validated with the item.xsd

Key important points for items.xml
  • The item type in itself is of type Item and GenericItem is the default parent of each item type
  • The instance of the item type stored is the item type table, but the item type definition is stored in the composed type. e.g. customer item type, the instances of Customer will be stored in the Customer table, but the definition of Customer will be stored in the composedType table.
  • Any extension can have an items.xml file to define the data model used in the extension. But this file is not mandatory to have.
  • GenericItem is the default parent of each item type.

The order in which the types are declared is very important. The order in which types are defined must conform to below

  • Atomic types
  • collection types
  • enum types
  • map types
  • relation types
  • item types

Add new attribute in Extproduct type and extend Product.

<itemtype code=”ExtProduct” extends=”Product”>

//define if any attribute 
</itemtype>

Leave a Comment

Your email address will not be published. Required fields are marked *