ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Piechota <piech...@gmail.com>
Subject List of all people and the company they work for
Date Wed, 13 Feb 2013 23:09:52 GMT
Hi,

What's the recommended approach to getting a list of Persons and the Party
Group that they are in an EMPLOYMENT relationship with?

Some context:

Since a Person can be on either end of a PartyRelationship the SQL query
I've cooked up involves Left Joins with OR conditions.

I've been unable to do this with a view-entity since the view-links seem to
require at least one AND in any boolean condition (i.e., they require at
least one key-map which gets AND'ed with any provided entity-conditions).

I've edited my local install to relax the view-link requirements so that
they just require *some* condition whether from a key-map, entity-condition
or both. If there isn't a recommended approach to the above, I can look
into opening a JIRA issue and attaching a patch.

For reference, this is the sort of SQL query I've been trying to build:

select PERSON.FIRST_NAME, PARTY_GROUP.GROUP_NAME
from PERSON
left outer join PARTY_RELATIONSHIP
    on (PERSON.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_FROM or
PERSON.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_TO) and
PARTY_RELATIONSHIP.PARTY_RELATIONSHIP_TYPE_ID = 'EMPLOYMENT'
left outer join PARTY_GROUP
    on (PARTY_GROUP.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_FROM or
PARTY_GROUP.PARTY_ID = PARTY_RELATIONSHIP.PARTY_ID_TO) and
PARTY_RELATIONSHIP.PARTY_RELATIONSHIP_TYPE_ID = 'EMPLOYMENT'

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message