Disable interceptors for impex

We can disable interceptors while importing impex files.

REMOVE Order[disable.interceptor.beans='orderPrepareInterceptor']; pk[unique = true]
; 1234567891234

INSERT_UPDATE Order[disable.interceptor.beans='orderPrepareInterceptor']; code[unique = true]
; order-123

Accsess backoffice config

While in backoffice in Adminstration Perspective you can press F4 button from keyboard. Then click menu icon on right corner for Show cockpit-config.xml option.

hybris system requirements

hybris minimum requirements by versions. Preferred DB charset is utf8 and collation is utf8_bin.

JVMSapMachine 11 or Oracle JDK/JRE 11SapMachine 11SapMachine 11Oracle 8.0 or SAP JVM 8.1 Oracle 8.0 or SAP JVM 8.1
MySQL 5.7 (jdbc  5.1.x), 8.0 (jdbc 8.x)MySQL 5.7 (jdbc 5.1.x), 8.0 (jdbc 8.x)MySQL 5.6, 5.7 (jdbc  5.1.x), 8.0 (jdbc 8.x)MySQL 5.6, 5.7 (jdbc  5.1.x) ) MySQL 5.6, 5.7 (jdbc  5.1.x) )
ImageMagick 6.7.3-56.7.3-56.7.3-5 6.7.3-5 6.7.3-5
Tomcat 8.5.568.5.518.5.40 8.5.40

hybris installer failed

If you are getting error while installing receipt like below, although you have set the parameter, check your maven settings for central repositories URLs start with HTTPS.

Either platform properties or system environment does not have the required property 'initialpassword.admin' set.
Please make sure to provide it in the recipe or in the system environment.

If you are running recipe using installer application you can set required property via option
-A local_property:initialpassword.admin=property_value

If missing property is initialpassword.admin then you can set it up using
shortcut -A initAdminPassword=admin_password

Maven disabled HTTP repositories. You can use below sample maven config file at <user-home>\.m2\settings.xml.

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

Source: https://stackoverflow.com/questions/59972570/why-does-hybris-ship-insecure-http-maven-repository-url-and-why-cant-we-overri

My hybris development environment test

I am using my company mac pro 2015 for a lot of thing. So I need different environment look like C#, hybris, ABAP, etc. These environment needs service look like db. These service using my ram always. So I am using VM for environment which are not used often. I created VM for new hybris versions for testing (docker cannot pause / resume systems yet). I try some scenarios for my best hybris development environment.

VM: OS version Centos 7, Java 8 u162, MySQL 5.7.21 and hybris version 6.6.

Enviroment Compile time (ant clean all)
Hybris files in host shared with guest vm 21 minutes 9 seconds
Hybris files in guest vm 3 minutes 8 seconds
2 minutes 29 seconds
Hybris files in guest vm and shared with host (without nfs optimization)  5 minutes 44 seconds


Creating history for item

If you want create history for item look like backoffice, you can use below example.

public void updateConsignmentStatus(String userUid, ConsignmentModel consignment, ConsignmentStatus status) {
  Map<string, object=""> originals = new HashMap();
  originals.put(ConsignmentModel.STATUS, consignment.getStatus());


  Map<string, object> news = new HashMap();
  news.put(ConsignmentModel.STATUS, consignment.getStatus());

  final SavedValues savedValues = JaloConnection.getInstance().logItemModification(consignment.getPk(), news, originals, false);

Creating,updating or deleting other items in interceptor

public class MyCustomerPrepareInterceptor implements PrepareInterceptor {
private static final Logger LOG = Logger.getLogger(MyCustomerPrepareInterceptor.class);

public void onPrepare(CustomerModel customerModel, InterceptorContext interceptorContext) throws InterceptorException {
  . . .
  final MyItemModel myItem = 
  //interceptorContext.registerElementFor(myItem, PersistenceOperation.DELETE);
  . . .

DB connection for DDL in groovy


In hybris hac, you cannot run DDL (data definition language) commands. You need unprotected connection to db. You can use below groovy example. Attention: DDL commands are dangerous!!!

import java.util.List;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

def config = spring.getBean("configurationService").getConfiguration();

DriverManagerDataSource dataSource = new DriverManagerDataSource();
JdbcTemplate jdbc = new JdbcTemplate(dataSource)

Using separate file for different class logging

Below example logging flexiblesearch class to separate file with time based trigger policy. Also we can add rollover strategy for removing old files.

log4j2.appender.FlexlogAppender.type=RollingFile log4j2.appender.FlexlogAppender.name=FlexlogAppender
log4j2.appender.FlexlogAppender.ImmediateFlush=true log4j2.appender.FlexlogAppender.layout.type=PatternLayout
log4j2.appender.FlexlogAppender.layout.pattern=%m%n log4j2.appender.FlexlogAppender.policies.type = Policies
log4j2.appender.FlexlogAppender.policies.time.type = TimeBasedTriggeringPolicy log4j2.appender.FlexlogAppender.policies.time.interval = 1000000
log4j2.appender.FlexlogAppender.policies.time.modulate = true log4j2.logger.flexible.name = de.hybris.platform.jalo.flexiblesearch
log4j2.logger.flexible.level = DEBUG log4j2.logger.flexible.appenderRef.stdout.ref = FlexlogAppender log4j2.logger.flexible.additivity = false