I see you intent to make two of compound key (budgetId and budgetItemSeqId)
of PaymentBudgetAllocation entity 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 entity 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>
-- 
View this message in context: 
http://www.nabble.com/Many-entities-that-should-has-foreign-key-but-it-not%2C-why--tp18089666p18089666.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to