When we try to create a new instance of an item type programmatically, we have two options, using the java way, using a new operator or the hybris way, using the model service.
- ProductModel product1 = new ProductModel();
- ProductModel product2 = model service.create(ProductModel.class);
- The advantages of using a model service method are below:
- The model service creates method will generate and assign the pk for the product object.
- The create method will initialize the default values, defined in items.xml for mandatory attributes.
- While calling save all methods, the object is already attached to the context and will be saved. While product1 needs to attach explicitly.
So we should always go for a model service way in hybris.
Q5) Why models are generated in platform extensions?
Ans. Hybris is built over the concepts of extensions. Each extension has it’s own data model. Any extension can use an item type from another extension and extend it as per requirement.
For example, the item type product defined in core extension. The catalog extension has extended the product item type and added the vendor to it.
While building the hybris, the frameworks build according to dependencies. Since the core is built before the catalog extension, it is not aware of the vendor attribute defined in catalog extension. If we keep model class in extensions, then there will e a chance to build failures. Like in our case, vendor attributes will not find a place in the Product Model class.
Hybris build framework, creates model classes, even before, building any extension. The platform is the best place to keep them, as every extension is built upon it only. So it is not logical to create model classes in particular extensions when we can define the same data model in various extensions.
Q6) How to split an order into multiple consignments?
Ans. While fulfilling an order, sometimes it is necessary for a business to split the order into multiple orders.
For instance, a customer orders two items A and B, now A has a delivery window of 2 days, while B can be delivered in a minimum of 5 days. Now the business has the option to either ship both items in 5 days. But what if item A is fresh, and will get destroyed in 5 days. There may be a case, where customers want a mandatory delivery of item A within 2 days. In such situations, if a business house doesn’t want to lose a customer, it has no choice but to split the order and ship it multiple times. This is the case of the split consignment.
Now there may be various conditions, which may call for splitting the order into multiple consignments. The above example is just one of them. For example, we may want to split consignment, based on the warehouse from where the item will be picked up. We may want to split consignment, based on product type (fresh or ambient), etc. These situations which decide the business logic to be a case for splitting the consignments are known as splitting strategies. We can have as many as a strategy to split, as we want.
By default, hybris creates only one consignment for an order. This is done by the following service.
As you can see, the order Splitting Service accepts a list of strategies, we can create many strategies, and split our order. The actual business logic for splitting will go into strategy class.
Q7) How to set up an svn environment for hybris projects?
Ans. Maintaining a versioning system for any project is one of the most crucial aspects. Hybris projects are not special in this regard. They also do have the same life cycle in terms of development. We need to maintain different environments like SIT, UAT, etc. To provide a local development environment is also equally important.
Since the size of OOB Hybris is huge, it is difficult to put everything in SVN (or GIT). Also, it is not advisable. The hybris is improvising every day. A new release should not give us pain in terms of development.
The best practice for versioning a hybris project could be:
- Put only a custom folder, containing customized extensions to versioning software.
- Pass the latest local.properties, local extensions locally to each developer.
- Maintain a copy of the latest local.properties, local extensions in each of servers like development and SIT, UAT, etc.
- Hybris software is wrapped around custom folders on each environment.
- Media folder could possibly in SVN or can be passed locally like property files.
The production environment normally is not connected to SVN. Rather we take the most stable copy from UAT and deploy it using some deployment tool like bamboo
Q8) What are Catalog aware item types?
Ans. While creating a data model for your project, you might come across situations, where you might want some of your item types to be part of a catalogue. This means, you want them to synchronize, you want them to be associated with a catalogue, content, or product. Such item types are known as catalogue awareness. It’s not just CMS item types or products, that need synchronization. All OOB CMS items and products are catalogue aware.
- To explicitly make an item type to be catalogue aware, follow the below steps:
- Mark your item as catalogue item type, using custom property catalogue ItemType.
- Choose attribute from the item, which will qualify the catalogue associated using custom property catalogue Version Attribute Qualifier.
- Since each item in a catalogue must be unique, we need to choose an attribute from the item which is unique. This can be done using a custom property unique Key Attribute Qualifier.
java.lang.Boolean.TRUE ”catalogVersion” ”code”
Once updating your item type, you should update your platform, using a system update.
And you should see something like below in HMC > System > item types > My ItemType > Extended
Now, instances of this item type will be catalogue aware and would be part of synchronization.
SAP Hybris Interview Questions For Freshers
Q9) Will it perform if we have over 1 million SKUs?
Ans. Yes, if you have used APIs, Flexi search in the right way. If you have used pagination in your Flexi search and converter caches then it will not matter how many SKUs you have.
Q10) Is it Scalable?
- Hybris is a spring JEE based platform and it is as scalable as any other java based platform.
- Adding a new cluster node is just a matter of starting a new Hybris instance with 3 property changes.
- Hybris will automatically add that node in the cluster. It has distributed cache per server and its out of box cache invalidation over UDP is very much efficient.
Q11) Is it configurable or require deployment for all sort of changes?
Ans. Mostly configuration until you have not done your own customizations. Even you can expose your custom elements to him and from there you can also change your configuration on the fly.
Q12) How easy it is to migrate from existing Magento or custom eCommerce solutions to the Hybris platform?
Ans. It will depend but highly feasible. Their data import process is very much flexible. Once data mapping is done it is easy to migrate.
Q13) How secure it is?
Ans. Spring security is an integrated OOB.
Q14) How frequently do their releases?
Ans. They have a pre-defined roadmap. Please refer wiki.hybris.com
Q15) What is the difference between PIM and PCM?
Ans. Consider them synonyms.
Hybris Testing Interview Questions
Q16) How easy to learn this?
Ans. Actually, if you know spring and have a concept of basic e-commerce then not much effort required to learn the Hybris platform. You need to be familiar with Impex and Flexi search syntax but plenty of examples are available to learn this.
Q17) Do they have on Demand flavour also?
Ans. Yes, recently introduced as an offering.
Q18) Can we use Hybris for product enrichment also?
Ans. Yes, their PIM module is meant for this.
Q19) How you will compare this with ATG or WCS?
Ans. Very soon Hybris will be on top of these because of its simplicity.
Q20) Can we use this as a fully-fledged content management solution?
- No, if your site is very much specific to content management and you want to manage a specific version of -individual content than cms is not the right solution for you.
- Otherwise, it has all features that are required for an e-commerce application.
Q21) How flexible promotion module is?
Ans. A lot many promotions are available out of the box and you can extend their framework very easy to introduce your custom promotion.
Q22) Please talk about search capabilities?
Ans. Google commerce search overcloud. What else I need to say. If GCS doesn’t suit you then use SOLR as a free solution. It is available OOB.
Q23) What integration topologies it provides?
Ans. Whatever you want....pre-integrated ActiveMQ on tomcat is available for messaging. Restful web services frameworks are available OOB.
Q24) Does it have business processing capabilities also?
Ans. Yes, limited but you can define your workflows. Moreover, you can modify your workflow decisions on the fly through hmc.