mamur
mamur

Reputation: 371

One to Many relation in hybris

I have two types like AbstractOrder and OrderEntryDetails. They are related one to many. In backoffice I want to display 4 fields from AbstractOrder(code,date,totalPrice,user) table and 1 field(productcode) from OrderEntryDetails table. In my cus_ext-backoffice-config file I am calling it like below

<context merge-by="type" parent="GenericItem" type="AbstractOrder" component="listview">
    <lv:list-view xmlns:lv="http://www.hybris.com/cockpitng/component/listView">

        <lv:column qualifier="code"/>
        <lv:column qualifier="date" spring-bean="dateTimeListCellRenderer"/>
        <lv:column qualifier="totalPrice" spring-bean="numberDigitZeroListCellRenderer"/>
        <lv:column qualifier="user"/>       
        <lv:column qualifier="productCode"/>        

    </lv:list-view>
</context>

Hybris generated orderEntryDetails field in AbstactOrderModel.java file and it is collection.

Edit

My question is how to display productCode form orderEntryDetails collection which is inside AbstactOrder?

If my approach is not right, can someone please tell me some easier way to display some data from related(relation between two tables) tables.

Upvotes: 0

Views: 2459

Answers (1)

mkysoft
mkysoft

Reputation: 5758

You can use Dynamic Attribute for productCode: https://help.hybris.com/6.3.0/hcd/8bb46096866910149208fae7c4ec7596.html

Same way used for QuantityDeclined on ConsignmentEntry. May be my opinion is not best solution.

Upvotes: 1

Related Questions