// select X from Deal d, entity_access ea, team_member tm where ea.entity = "Deal" and ea.partyEntityType = "Team"
// and ea.party_id = tm.team_id and tm.party_id = <partyId> and ea.entity_id = d.deal_id
DynamicViewEntity dve = EntityHelper.createDynamicViewEntity( delegator, "Deal");
dve.addMemberEntity("EntityAccess", "EntityAccess");
dve.addMemberEntity("TeamMember", "TeamMember");
dve.addViewLink("Deal", "EntityAccess", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("dealId", "entityId")));
dve.addViewLink("EntityAccess", "TeamMember", Boolean.FALSE, UtilMisc.toList(new ModelKeyMap("partyId", "teamId")));
dve.addAlias("EntityAccess", "partyEntityType", null, null, null, null, null);
dve.addAlias("EntityAccess", "entity", null, null, null, null, null);
dve.addAlias("TeamMember", "tmPartyId", "partyId", null, null, null, null);
EntityCondition condition = new EntityConditionList(UtilMisc.toList(