Sap Hybris Interview Questions
How To Run Multiple Hybris Instance In One Machine?
Basically hybrid runs on a tomcat instance. Hybris is shipped with a bundled tomcat. So the question here is actually, how to run multiple tomcat in one machine.
We can run as many hybris we want, till our machine memory permits. To do so, we need to make each instance of tomcat to have it’s own ports to use. Make below ports unique for each instance. We should add below properties in local property file of each instance with unique values..
tomcat.http.port=7001
tomcat.ssl.port=7002
tomcat.ajp.port=7009
tomcat.jmx.port=7003
tomcat.jmx.server.port=7004
Why Order Is Important In Items.xml?
We need to follow an order in items.xml, when we declare item types in items.xml. Below are the reasons for it.
Each items.xml is parsed in single pass. This means, more specific types are dependent on general types. In such case they should have been defined before we use them. For example,
Here we see that, item type product is using other item types, like catalog. To make this file successfully, it is mandatory that catalog exist before product is declared. We must defines types in order of inheritance.
NOTE: Impex files are parsed in multiple pass, so order is not important there.
Each xml file is validated against a items.xsd during build. If the xml file does not conforms to xsd file, build will fail.
What Is Role Of Jalosession?
The Jalo layer in hybris is depreacted, not the jalosession.
Whenever a request is made to hybris server, it may need current user details, currency, language, timezone etc to serve that request efficiently. Since HttpSession does not hold all these details, hybris came up with the concept of JaloSession.
Whenever a request comes to Hybris, the filter HybrisInitFilter creates an object of JaloSession. Every JaloSession object is associated with a SessionContext object, which has current user, language, currency etc and the current httpSession object.
Cron jobs also run in a JaloSession.
Each JaloSession is bound to a tenant. This cannot be changed, after the instance of JaloSession is created.
JaloSession is never made persistent in database.
What Are Model Attributes?
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). For example, the titles (Mr and Mrs etc). They can be used in many JSPs and tags file, like registration, delivery address etc.
In such cases, what we do is, create a convenient method in Abstract controllers, and use model attribute annotation for them. In this way they are available from all JSPs directly using model attribute.
These can be accessed directly in JSPs or even tag files. like
Current Language : ${current Language}
Model service create method vs new operator
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.
ProductModel product1 = new ProductModel();
ProductModel product2 = modelService.create(ProductModel.class);
The advantages of using model service method are below:
The model service create method will generate and assign the pk for product object.
The create method will initialize the default values, defined in items.xml for mandatory attributes.
While calling save all method, the object is already attached to context, and will be saved. While product1 needs to attach explicitly.
So we should always go for model service way in hybris.
Why Models Are Generated In Platform Extensions?
Hybris is build over the concepts of extensions. Each extension has it’s own data model. Any extension can use an item type from other extension and extend it as per requirement.
For example, the itemtype product defined in core extension. The catalog extension has extended the product itemtype, and added vendor to it.
While building the hybris, the frameworks builds according to dependencies. Since core is build before 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 chance of build failures. Like in our case, vendor attribute will not find a place in 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 same data model in various extension.
How To Split An Order Into Multiple Consignment?
While fulfilling an order, some time it is necessary for business to split the order into multiple orders.
For instance, a customer orders two items A and B, now A has delivery window of 2 days, while B can be delivered in minimum 5 days. Now 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 customer wants a mandatory delivery of item A within 2 days. In such situations, if business house doesn’t want to loose customer, it has no choice but to split order and ship it multiple times. This is the case of split consignment.
Now there may be various conditions, which may call for splitting the order into multiple consignments. Above example is just one of them. For example, we may want to split consignment, based on warehouse from where item will be picked up. We may want to split consignment, based on product type (fresh or ambient) etc. These situations which decides the business logic to be a case for splitting the consignments, are known as splitting strategies. We can have as many as strategy to split, as we want.
By default, hybris creates only one consignment for an order. This is done by following service.
As you can see, that 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.
How To Setup A Svn Environment For Hybris Projects?
Maintaining a version system for any project is one of the most crucial aspect. 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 custom folder, containing customized extensions to versioning software.
Pass latest local.properties, local extensions locally to each developers.
Maintain copy of latest local.properties, local extensions in each of servers like development and SIT, UAT etc.
Hybris software is wrapped around custom folder on each environment.
Media folder could possibly in SVN or can be passed locally like property files.
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.
These core tutorials will help you to learn the fundamentals of Tableau.
For an in-depth understanding and practical experience, explore SAP Hybris Training.
What Are Catalog Aware Item Types?
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 catalog. This means, you want them to synchronize, you want them to be associated with a catalog, content or product. Such item types are known as catalog aware. It’s not just CMS item types or products, that needs synchronization. All OOB CMS items and products are catalog aware.
To explicitly make an item type to be catalog aware, follow below steps:
Mark your item as catalog item type, using custom property catalog ItemType.
Choose attribute from item, which will qualify the catalog associated using custom property catalog Version Attribute Qualifier.
Since each item in a catalog must be unique, we need to choose an attribute from item which is unique. This can be done using custom property unique Key Attribute Qualifier.
<itemtype code=”MyItemType” autocreate=”false” generate=”false”>
<custom-properties>
<property name=”catalogItemType”><value>java.lang.Boolean.TRUE</value></property>
<property name=”catalogVersionAttributeQualifier”><value>”catalogVersion”</value></property>
<property name=”uniqueKeyAttributeQualifier”><value>”code”</value></property>
</custom-properties>
<attributes>
<attribute qualifier=”catalogVersion” type=”CatalogVersion”>
<modifiers read=”true” write=”true” search=”true” optional=”false” unique=”true”/>
<persistence type=”property”/>
</attribute>
Once updating your item type, you should update your platform, using system update.
And you should see something like below in HMC > System > item types > My ItemType > Extended
Now, instances of this itemtype will be catalog aware, and would be part of synchronization.
Will It Perform If We Have Over 1 Million Skus?
Yes, if you have used APIs, flexi search in a right way. If you have used pagination in your flexi search and converter caches than it will not matter how much SKUs you have.
Is It Scalable?
Hybris is spring JEE based platform and it is as scalable as any other java based platform.
Adding new cluster node is just a matter of starting a new Hybris instance with 3 property changes.
Hybris will automatically add that node in cluster. It has distributed cache per server and it’s out of the box cache invalidation over UDP is very much efficient.
Is It Configurable Or Require Deployment For All Sort Of Changes?
Mostly configuration until you has not done your own customizations. Even you can expose your custom elements to hmc and from there you can also change your configuration on the fly.
How Easy It Is To Migrate From Existing Magento Or Custom Ecommerce Solution To Hybris Platform?
It will depend but highly feasible. Their data import process is very much flexible. Once data mapping is done it is easy to migrate.
How Secure It Is?
Spring security is integrated OOB.
How Easy To Learn This?
Actually if you know spring and has concept of basic ecommerce than not much effort required to learn Hybris platform. You need to be familiar with impex and flexi search syntax but plenty of examples are available to learn this
Do They Have On Demand Flavor Also?
Yes, recently introduced as an offering.
Can We Use Hybris For Product Enrichment Also?
Yes, their PIM module is meant for this.
How You Will Compare This With Atg Or Wcs?
Very soon Hybris will be on top of these because of its simplicity.
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 specific version of -individual content than wcms is not the right solution for you.
Otherwise it has all features that are required for an ecommerce application.
How Flexible Promotion Module Is?
Lot many promotions are available out of the box and you can extend their framework very easily to introduce your custom promotion.
Please Talk About Search Capabilities?
Google commerce search over cloud. What else I need to say. If GCS doesn’t suits to you then use SOLR as a free solution. It is available OOB.