How to model party relationship data in ofbiz?

吃可爱长大的小学妹 提交于 2019-12-09 21:41:47

问题


I'm confused with the ofbiz data model.

PARTY RELATIONSHIP is a relationship from one PARTY to a another PARTY corresponding to a pair of PARTY ROLEs.

Entity PARTY RELATIONSHIP will have PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO and PARTY_RELATIONSHIP_TYPE_ID which is stored in PARTY RELATIONSHIP TYPE entity.

But in that entity is also stored ROLE_TYPE_ID_VALID_FROM and ROLE_TYPE_ID_VALID_TO.

Could have duplicate data in there ?

And would PARTY_RELATIONSHIP_TYPE_ID be a part of the key to the PARTY RELATIONSHIP entity?


回答1:


A PARTY RELATIONSHIP joins only two other entities:

1) A PARTY RELATIONSHIP TYPE which associates two ROLE TYPES: e.g. supplier to customer or employee to department.

2) The actual PARTIES participating in the relationship ROLES: e.g. ABC COMPANY as supplier and Thang Nguyen as customer.

These parties in their respective roles are what's represented by the PARTY ROLE entity.

This PARTY ROLE entity may be expressed in a table, in which case you would have PARTY ROLE ID's for each of the two parties in the relationship. Or the party role may not have a separate table and only be realized in the Party Relationship table, in which case it will have, as you specify, a PARTY and ROLE TYPE ID for each of the parties in the relationship.

You won't have duplicate data in the PARTY RELATIONSHIP entity because FROM DATE is part of the key and would be unique in combination with the two PARTY ROLES.

The from and to dates are for that party relationship, not party relationship type.



来源:https://stackoverflow.com/questions/21820972/how-to-model-party-relationship-data-in-ofbiz

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!