Search code examples
springsap-commerce-cloudhybris-data-hub

How to populate data in OrderEntryData


I added one attribute in AbstractOrderEntryModel, but I want to populate this attribute in OrderEntryData. I added just a new property in OrderEntryData but it's not working.

So to get this in OrderEnryData do we have to write separate populator for this?


Solution

  • Add the new attribute in extension-beans.xml. Below code will add the new attribute to the existing OrderEntryData bean.

    <bean class="de.hybris.platform.commercefacades.order.data.OrderEntryData">
        <property name="newAttribute" type="Integer"/>
    </bean>
    

    You will also need to create a new Populator (see de.hybris.platform.commercefacades.order.converters.populator.OrderEntryPopulator for reference), and add the populator to the converter via customextenstion-spring.xml.

    <bean id="customOrderEntryPopulator" class="com.chang.populators.CustomOrderEntryPopulator" />
    
    <bean parent="modifyPopulatorList">
        <property name="list" ref="orderEntryConverter"/>
        <property name="add" ref="customOrderEntryPopulator"/>
    </bean>
    

    Other references: