How to model party relationship data in ofbiz?

2020-07-23 07:01发布

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?

Party relationship model

1条回答
闹够了就滚
2楼-- · 2020-07-23 07:33

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.

查看更多
登录 后发表回答