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

Tanakorn updated OFBIZ-1845:
----------------------------

    Description: 
I see you intent to make two of compound key (budgetId and budgetItemSeqId) 
have relation-type = nofk that not similar to "The Data Model Resource Book 
Vol.1" in Figure 8.10. I think you have to has a good reason for implementation

/applications/accounting/entitydef/entitymodel.xml

<entity entity-name="PaymentBudgetAllocation"
            package-name="org.ofbiz.accounting.payment"
            title="Payment Budget Allocation Entity">
      <field name="budgetId" type="id-ne"></field>
      <field name="budgetItemSeqId" type="id-ne"></field>
      <field name="paymentId" type="id-ne"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <prim-key field="paymentId"/>
      <relation type="one" fk-name="PAYMENT_BA_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
 -    <relation type="one-nofk" rel-entity-name="BudgetItem">
+   <relation type="one" fk-name="PAYMENT_BUDGIT" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_BA_PMT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
    </entity>

and another question in the same figure in the book (Figure 8.10). In 
order_item has two attribute that is budgetId and budgetItemSeqId but you don't 
use it to link to budget_item entity, and I don't know why?

/applications/order/entitydef/entitymodel.xml

<entity entity-name="OrderItem"
            package-name="org.ofbiz.order.order"
            never-cache="true"
            title="Order Item Entity">
      <field name="orderId" type="id-ne"></field>
      <field name="orderItemSeqId" type="id-ne"></field>
      <field name="externalId" type="id"></field>
      <field name="orderItemTypeId" type="id-ne"></field>
      <field name="orderItemGroupSeqId" type="id-ne"></field>
      <field name="isItemGroupPrimary" type="indicator"></field>
      <field name="fromInventoryItemId" type="id"></field>
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      ...
+   <relation type="one" fk-name="ORDER_ITEM_BUDGET_ITEM" 
rel-entity-name="BudgetItem">
+      <key-map field-name="budgetId"/>
+       <key-map field-name="budgetItemSeqId"/>
+    </relation>

  was:
I see you intent to make two of compound key (budgetId and budgetItemSeqId) 
have relation-type = nofk that not similar to "The Data Model Resource Book 
Vol.1" in Figure 8.10. I think you have to has a reason implementation

/applications/accounting/entitydef/entitymodel.xml

<entity entity-name="PaymentBudgetAllocation"
            package-name="org.ofbiz.accounting.payment"
            title="Payment Budget Allocation Entity">
      <field name="budgetId" type="id-ne"></field>
      <field name="budgetItemSeqId" type="id-ne"></field>
      <field name="paymentId" type="id-ne"></field>
      <field name="amount" type="currency-amount"></field>
      <prim-key field="budgetId"/>
      <prim-key field="budgetItemSeqId"/>
      <prim-key field="paymentId"/>
      <relation type="one" fk-name="PAYMENT_BA_BDGT" rel-entity-name="Budget">
        <key-map field-name="budgetId"/>
      </relation>
 -    <relation type="one-nofk" rel-entity-name="BudgetItem">
+   <relation type="one" fk-name="PAYMENT_BUDGIT" rel-entity-name="BudgetItem">
        <key-map field-name="budgetId"/>
        <key-map field-name="budgetItemSeqId"/>
      </relation>
      <relation type="one" fk-name="PAYMENT_BA_PMT" rel-entity-name="Payment">
        <key-map field-name="paymentId"/>
      </relation>
    </entity>

and another question in the same figure in the book (Figure 8.10). In 
order_item has two attribute that is budgetId and budgetItemSeqId but you don't 
use it to link to budget_item entity, and I don't know why?

/applications/order/entitydef/entitymodel.xml

<entity entity-name="OrderItem"
            package-name="org.ofbiz.order.order"
            never-cache="true"
            title="Order Item Entity">
      <field name="orderId" type="id-ne"></field>
      <field name="orderItemSeqId" type="id-ne"></field>
      <field name="externalId" type="id"></field>
      <field name="orderItemTypeId" type="id-ne"></field>
      <field name="orderItemGroupSeqId" type="id-ne"></field>
      <field name="isItemGroupPrimary" type="indicator"></field>
      <field name="fromInventoryItemId" type="id"></field>
      <field name="budgetId" type="id"></field>
      <field name="budgetItemSeqId" type="id"></field>
      ...
+   <relation type="one" fk-name="ORDER_ITEM_BUDGET_ITEM" 
rel-entity-name="BudgetItem">
+      <key-map field-name="budgetId"/>
+       <key-map field-name="budgetItemSeqId"/>
+    </relation>


> Why PaymentBudgetAllocation's budgetid and budgetitemseqid was not foreing 
> key for budgetitem
> ---------------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-1845
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1845
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: SVN trunk
>         Environment: /applications/accounting/entitydef/entitymodel.xml
>            Reporter: Tanakorn
>            Priority: Trivial
>             Fix For: SVN trunk
>
>
> I see you intent to make two of compound key (budgetId and budgetItemSeqId) 
> have relation-type = nofk that not similar to "The Data Model Resource Book 
> Vol.1" in Figure 8.10. I think you have to has a good reason for 
> implementation
> /applications/accounting/entitydef/entitymodel.xml
> <entity entity-name="PaymentBudgetAllocation"
>             package-name="org.ofbiz.accounting.payment"
>             title="Payment Budget Allocation Entity">
>       <field name="budgetId" type="id-ne"></field>
>       <field name="budgetItemSeqId" type="id-ne"></field>
>       <field name="paymentId" type="id-ne"></field>
>       <field name="amount" type="currency-amount"></field>
>       <prim-key field="budgetId"/>
>       <prim-key field="budgetItemSeqId"/>
>       <prim-key field="paymentId"/>
>       <relation type="one" fk-name="PAYMENT_BA_BDGT" rel-entity-name="Budget">
>         <key-map field-name="budgetId"/>
>       </relation>
>  -    <relation type="one-nofk" rel-entity-name="BudgetItem">
> +   <relation type="one" fk-name="PAYMENT_BUDGIT" 
> rel-entity-name="BudgetItem">
>         <key-map field-name="budgetId"/>
>         <key-map field-name="budgetItemSeqId"/>
>       </relation>
>       <relation type="one" fk-name="PAYMENT_BA_PMT" rel-entity-name="Payment">
>         <key-map field-name="paymentId"/>
>       </relation>
>     </entity>
> and another question in the same figure in the book (Figure 8.10). In 
> order_item has two attribute that is budgetId and budgetItemSeqId but you 
> don't use it to link to budget_item entity, and I don't know why?
> /applications/order/entitydef/entitymodel.xml
> <entity entity-name="OrderItem"
>             package-name="org.ofbiz.order.order"
>             never-cache="true"
>             title="Order Item Entity">
>       <field name="orderId" type="id-ne"></field>
>       <field name="orderItemSeqId" type="id-ne"></field>
>       <field name="externalId" type="id"></field>
>       <field name="orderItemTypeId" type="id-ne"></field>
>       <field name="orderItemGroupSeqId" type="id-ne"></field>
>       <field name="isItemGroupPrimary" type="indicator"></field>
>       <field name="fromInventoryItemId" type="id"></field>
>       <field name="budgetId" type="id"></field>
>       <field name="budgetItemSeqId" type="id"></field>
>       ...
> +   <relation type="one" fk-name="ORDER_ITEM_BUDGET_ITEM" 
> rel-entity-name="BudgetItem">
> +      <key-map field-name="budgetId"/>
> +       <key-map field-name="budgetItemSeqId"/>
> +    </relation>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to