Search code examples
sap-commerce-cloud

Why hybris jalo layer generate two classes for an item


For an item type MyType, hybris generate two classes.

a. Gensrc/de/hybris/jalolayer/sample/GeneratedMyType.java
b. src/de/hybris/jalolayer/sample/MyType.java

As I went through the documentation,

GeneratedMyType.java is an abstract class that contains getter and setter methods, whereas MyType.java is the subclass that extends the abstract class GeneratedMyType.java.

MyType.java extends GeneratedMyType and provide business logic.

As I see one advantage, whenever item type is changed in items.xml, hybris can override GeneratedMyType.java. In this way, hybris can reflect new properties attached to the item type in items.xml. Is there any other advantages of generating abstract and concrete classes for the same item type.


Solution

  • The advantage you mentioned is the most important advantage, as any business logic you implement in MyType.java does not get overridden by the generation process. The generation process only generates/modifies GeneratedMyType.java.