SAP Hybris suite , Hybris tutorial, Java, J2ee Stuff Online-

Please explain ModelByExample of FlexibleSearchService in Hybris | using New Keyword to create Model in Hybris

Open 0 Answers 201 Views

You heard that Model should always create by using ModelService like 

EmployeeModel employeModel = ModelService.create(EmployeeModel.class);

But you also use creation of model by using NEW keyword but for some specific condition and purpose .  lets suppose you need to fetch model from DB then generally you will flexible search query but you do not to write query then in that case you can do as below 

Above can also achieve by using ModelByExample of FlexibleSearchService as below

B2BCustomerModel customerModel = new B2BCustomerModel();


customerModel = getFlexibleSearchService().getModelByExample(customerModel);

In above code your customerModel automatically attach to model fetch by flexible search service  . more or less it seems like detach in hibernate.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.