cancel
Showing results for 
Search instead for 
Did you mean: 

Getting "must not be an unmanaged association" while joining tables in view in CAP Java

KrishmaBhatia
Product and Topic Expert
Product and Topic Expert
0 Kudos
628

Hi,

I am trying to user inner join on tables as follows but while building CAP Java project,I am getting "InviteeRoleForOrgRelationshipView?: ?roles? in path ?Organization.roles.role.ID?" must not be an unmanaged association and InviteeRoleForOrgRelationshipView?: ?scenarios? in path ?Organization.scenarios.scenario.ID?" must not be an unmanaged association",can someone please explain what is the issue here and how it can be resolved? Below is the code reference:-

define view InviteeRoleForOrgRelationshipView as
    select from InviteeRoleForOrgRelationship
    inner join Organization
        on  Organization.roles.role.ID         = InviteeRoleForOrgRelationship.role.ID
        and Organization.scenarios.scenario.ID = InviteeRoleForOrgRelationship.scenario.ID
    {
        key InviteeRoleForOrgRelationship.role.ID       as role_ID,
            InviteeRoleForOrgRelationship.role.name     as roleName,
        key InviteeRoleForOrgRelationship.scenario.ID   as scenario_ID,
            InviteeRoleForOrgRelationship.scenario.name as scnName,
            Organization.type.ID                        as OrgType_ID
    };


entity InviteeRoleForOrgRelationship {
    key role     : Association to Role;
    key scenario : Association to Scenario;
}


entity Organization : managed {
    key ID             : String;
        type           : Composition of OrganizationType;
        scenarios : Composition of many OrganizationScenario
                        on scenarios.org = $self;
        roles          : Composition of many OrganizationRoles
                            on roles.org = $self;
}


entity OrganizationScenario : managed {
    key org       : Association to Organization;
    key scenario  : Association to Scenario;
}


entity OrganizationRoles {
    key org : Association to Organization;
    key role : Association to Role;
}


entity Role { 
key ID : String; 
name : String; organizationType : Composition of OrganizationType;
}


entity Scenario { 
key ID : Integer; 
name : String;
} 
  

Thanks!

Regards,

Krishma

Accepted Solutions (0)

Answers (1)

Answers (1)

hjb
Product and Topic Expert
Product and Topic Expert

Hi with

Organization.roles.role.ID 

By traversing 'roles' you are inducing another JOIN in an ON condition. This is not a direct foreign key access and hence not allowed.