Page 1 of 1

OrderItemImpl.orderItemAttributeMap map key is not persisted

Posted: Sat Apr 07, 2012 3:40 pm
by sai
Hi,

I was looking at utilizing

Code: Select all

 protected Map<String,OrderItemAttribute> orderItemAttributeMap;

But I see an issue with this, which is it is not storing the Map key anywhere in database. I thought that it is going to help me associate OrderItemAttribute using the key.

Ex: For an attribute of type XXXX I will be able to store in OrderItemAttribute with name include YY and value inclue 123.

When I am accessing I can access with the key XXXX and display/use id and value from the OrderItemAttribute

Please correct me if I am not understanding this right.

Thank you for the support.

Re: OrderItemImpl.orderItemAttributeMap map key is not persisted

Posted: Mon Apr 09, 2012 10:41 pm
by bpolster
The BLC implementation for OrderItemAttribute is to use the NAME as the key to the map. And the value as the value you want to store on the order.

You've introduced another term element, type which you are wanting to use as the "key".

Can you explain the actual business case you are trying to perform to help us understand whether we should introduce a framework change or advise you to extend OrderItemAttribute with your own custom class. If the latter, the name will still be the key and you would be extending the class to allow a place to enter your "type" field.

- Brian

Re: OrderItemImpl.orderItemAttributeMap map key is not persisted

Posted: Tue Apr 10, 2012 9:01 pm
by sai
When I said 'type' it does not mean type but let us say a key identifier of the Map.

I am trying to store some additional information to the orderItem, would like to store that in multiple categories.

For example:
Map<String, OrderITemAttribute>
KEY Name , Value
ShoeAttribute ---> <LEATHER1D, LeatherName>

custMeasurementProfile --> <profileId, profileName>

I thought this is how the above Map would let me store the information and I will be able to access Map key 'ShoeAttribute' and I can use name and value pair. I need to store the dynamic data selections in the attributes table with ID and Name and I need to somehow associate them together. With the current way I can probably store one set of functional aspect data only. When I store the data everything is good, but when I retrieve the data I donot know the attribute is shoe related or customer related, in an order item.

Just a thought that the below approach might help more in further categorizing the attributes in more manageable form to store multiple different aspects and having the Map key and the OrderItemAttribute Name separate can be more flexible. It is little bit confusing at this moment when I see it take the Map key and Name value pair in OrderItemAttribute.

Map<String, List<OrderITemAttribute>>
KEY Name , Value
ShoeAttribute ---> <leatherColor, blue>
<leatherType, xxx>
<etc:etc>
custMeasurementProfile --> <profile, 1>
<flexible, y>
<etc, etc>

But I understand now that Map key is same as Name in OrderItemAttribute.

Thank you for the clarification Brian.