Automatically generated javaBeans and enumerations, the new DataObjects

These JavaBeans are a new type of DTOs which can be extended by any extension and they are called DataObjects by SAP Hybris. It allows a custom extension to modify the POJOs (which are DTOs) used by the facades of the Hybris extensions without writing a subclass of the POJO, of the facade and writing a new converter. This means, that if the facade uses a JavaBean, you can extend it without touching the Hybris code.

Key Concepts

  • POJOs and enumerations may be defined in the file customextension/resources/customextension-beans.xml
  • The POJOs follow the JavaBeans convention: default constructor with no parameters and all the setters and getters start with get and set.
  • The POJOs and enumerations definitions are merged across extensions.
  • They are serializable.
  • A template to create the beans may be provided. If it doesn't exist, the default one is used.

Technical Implementation

  1. The definition of the beans is merged between all the extensions. Each bean has a name and a list of fields.
  2. Using a Velocity template a Java file is created.
  3. The Java file is compiled inside platform/ext/core/gensrc

Use Cases

  • This mechanism is used by the accelerator addOns to extend the DataObjects which are used by the standard Hybris extensions. For example, it can be used to extend the AbstractOrderData defined in commercefacades-beans.xml.


  • The classes referenced in the fields of the beans must also be DataObjects. A bean can only reference classes which are in platform/ext/core.

–Based on Hybris 6.4


Enter your comment. Wiki syntax is allowed: