[ 
https://issues.apache.org/jira/browse/OFBIZ-5356?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christian Carlow resolved OFBIZ-5356.
-------------------------------------

       Resolution: Not A Problem
    Fix Version/s: Release Branch 12.04

I discovered a less drastic solution than my previous suggestions.

A view-entity alias with the prim-key attribute set containing a complex alias 
that concatenates the primary keys using a separator value  was the solution.  

For example, this view-entity would be used for selecting unique order item 
when items of different orders exist in the same list:
    <view-entity entity-name="OrderItemOnePrimKey" 
package-name="org.ofbiz.order.order">
        <member-entity entity-alias="OI" 
entity-name="OrderItem"></member-entity>
        <alias-all entity-alias="OI" />
        <alias name="orderItemId" prim-key="orderItemId">
                <complex-alias operator="||">
                        <complex-alias-field entity-alias="OI" field="orderId" 
/>
                        <complex-alias-field value="'_pk_'"/>
                        <complex-alias-field entity-alias="OI" 
field="orderItemSeqId"/>
                </complex-alias>
        </alias>
    </view-entity>

The tradeoff is query speed.

Does anyone think this approach is insufficient to my previous suggestion about 
having single field primary keys for all db tables?  

> Ability to select Lookup records having more than one primary key field
> -----------------------------------------------------------------------
>
>                 Key: OFBIZ-5356
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5356
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: ALL APPLICATIONS
>    Affects Versions: Release Branch 12.04
>            Reporter: Christian Carlow
>             Fix For: Release Branch 12.04
>
>
> Having the ability to select a record from Lookup records containing more 
> than one primary-key field would be quite useful.
> I have the need to select a single OrderItem from a list of OrderItems 
> associated with more than one OrderHeader.  I also need to be able to select 
> a single ShipmentItem from a list containing multiple Shipments.
> Having single field primary keys for these tables would provide a solution 
> but would entail a lot of work to make the system use the new primary keys.
> Another way would be to allow for Lookup controls the ability to have 
> multiple keys associated with them.
> Either way, seems like a lot of work to make this happen.
> Anyone have a different solution?



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to