Difference between relations and collections in hybris?

P C raja picture P C raja · Jan 30, 2015 · Viewed 8.6k times · Source

I am new to hybris, What is diff b/w relations and collections, why we go for relations instead of collections.

Answer

Mafick picture Mafick · May 15, 2016

Basically, there are two technically different ways of modeling collections in hybris:

  1. CollectionTypes

    • Think of CollectionTypes in hybris as a backpack mounted onto a type
    • By runtime, CollectionTypes are resolved into a Collection of a kind of item, such as a List of MediaModels
    • Can cause overflow, resulting in truncation and therefore loss of data
    • More difficult to search and lower performance
    • On the database level, CollectionTypes are a comma-separated list of PKs, so there is a maximum
  2. RelationTypes

    • Create links between all kinds of types Create type-safe n-to-m relations: Only link such elements of the source / target type declared at the relation
    • Values for relations are stored in a separate database table +Each value is stored in a separate table row