Interceptors

We are aware about Hybris models that represent to database tables in Hybris. we often use models to save data in database and to load data from Database. These models use own lifecycle in Hybris for managed by ModelService. To intercept the behavior of life cycles of models, various types of interceptors have been developed. Each such interceptor addresses a particular step of the life cycle.

Interceptors can interrupt the lifecycle of a model and execute some logic and then lifecycle of the model can continue its process. Hybris offers interceptors that provide the possibility to Hook into model lifecycle to be able to act when an event occurs.

The predefined methods which represents the Model life cycle are:

  • Create: to create model instance;

  • Update: to update/modify the properties of the model;

  • Save: when we create or update Model we save back the model to update the database. If we have used a new model, a new record is created in the database, otherwise, the existing record is updated;

  • Load: to get existing model from the database;

  • Remove: to delete no longer needed records from the database.