Posts

How to configure catalog sync cronjob in Hybris?

Image
How to create custom catalog synchronization job in Hybris?
Scenario My client wants to have product catalog sync cronjob. So the first thing that came to my mind was, It's quite easy, by creating an instance of CatalogSyncCronJob and assign it to appropriate sync job(Product Sync stage to Online) and trigger. But it won't work like that.
CatalogVersionSyncJob is designed to run only once with each instance. So if we create sync job instance by ImpEx/HMC, it will not get any newly / modified items in the second execution. because system needs a new instance for each sync execution! Wondering, how catalog synchronization works when we do it form Hybris HMC(Catalog Management Tool > Synchronization)? If we execute catalog sync from Catalog Management Tool, then each time, Hybris internally creates a new instance of selected sync job. Hence, it can detect new or modified items to sync.


Solution We can write the custom job, which basically does the same thing as HMC sync. cre…

What is the PartOf modifier in Hybris items.xml?

What is PartOf? PartOf modifier is used to define the aggregation relationship between Parent and Child objects. To explain it better I would say PartOf is used to defining cascade delete. When we delete a Parent object then all its child objects(partOf) will be deleted automatically. Why or When to use PartOf? PartOf may make sense when the relationship involves "is part of" description. For example, an OrderEntry record(AbstractOrderEntry) is part of its parent Order(AbstractOrder), and older entries will never be shared between multiple orders. If the Order were to vanish, the OrderEntry should as well, and an order entry without an Order would be a problem. How to use PartOf? On the removal of an order, if we want to remove all associated order entries automatically, then we can define partOf in its relation like <relation code="AbstractOrder2AbstractOrderEntry" localized="false" generate="true" autocreate="true"> &…

How to Integrate DCEVM code hot-swapping with Hybris Platform

Image
Are you tired of restarting Hybris Platform everytime you change some Java code? Don’t worry, it happens to everyone. The good news is, there are tools available in the market which allow hot-swapping Java code in runtime(No need to redeploy). Like Jrebeldcevm etc. Well, Jrebel is very good tools, having many features, but everyone can't afford it(Not free!!). If you are an open sourcist (like me), go with open source DCEVM (Dynamic Code Evolution VM). Continue reading this post if you are looking for How to integrate DCEVM with Hybris Platform? JRebel alternatives for SAP Hybris Java code hot-swapping in Hybris Although, this is documented in help.hybris, here I'm elaborating exact steps/commands, which I've followed to configure DCEVM in my windows system. 1. Download DCEVM Download the latest release of DCEVM jar.
There are two modes to install the DCEVM
Enhanced Debugger (I'm going to configure this here) This is the simplest mode where the patched JVM allows to use…

How to create a Cronjob using Groovy script in SAP Hybris

You can skip scenario and root cause section below, if you only interested in the groovy script cronjob steps Scenario When we create the ProductReference inside the Product(for stage catalog) using Impex/API. The owning product is not getting sync when we do a catalog sync. Root Cause As per wiki Modification time issues: Keep in mind that changing a part-of item does not mark its owning item modified automatically. To allow synchronization to schedule the owning item correctly you have to mark it modified manually, preferably inside the part-of item's business code. So here, we can write After Save Event or groovy script to update its owning item(Product) modification time. Now let's see, how can we handle this using groovy script in SAP Hybris. Solution To configure the groovy script as a cronjob, you have to create an instance of Script - the item type where the script content is going to store. ScriptingJob - a new ServicelayerJob item, which contains additionally the scriptUR…

How to Install temporary Hybris license?

LICENSE VERIFICATION HAS FAILED!?
Your demo/develop license has expired, it is valid only for 30 days.?
How to install temp SAP Hybris license?


When you download & Install SAP Hybris Commerce suite, By default it ships with the 30 days initial demo license.There are three types of licenses: an initial, temporary license (valid for 90 days), an extension license (valid for a further 90 days), and a permanent commercial license. So if your demo license has expired still you have a chance to extend it by installing the temporary license. But once that also expires you have to re-initialize your system. So better you get the developer license to continue your work without re-initialize. To install a temporary license 1) Add the systemID in your local.properties license.sap.sapsystem=DEV 2) Go to Platform directory and run the ./license.sh with temp parameter like below. Choose the right command based on your DB. Run license.bat instead of ./license.sh if you are using windows based sys…