Why Models Are Generated In Platform Extensions?.So we should always go for model service way in hybris. While product1 needs to attach explicitly. While calling save all method, the object is already attached to context, and will be saved.The create method will initialize the default values, defined in items.xml for mandatory attributes.The model service create method will generate and assign the pk for product object.The advantages of using model service method are below: ProductModel product2 = modelService.create(ProductModel.class) ProductModel product1 = new ProductModel() When we try to create a new instances of an item type programmatically, we have two options, using the java way, using new operator or the hybris way, using the model service. Model service create method vs new operator These can be accessed directly in JSPs or even tag files. In this way they are available from all JSPs directly using model attribute. In such cases, what we do is, create a convenient method in Abstract controllers, and use model attribute annotation for them. They can be used in many JSPs and tags file, like registration, delivery address etc.
For example, the titles (Mr and Mrs etc). Some time it is necessary to get few data in many JSPs, and we don’t want to pass them as a part of DTO (data objects).