Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Data access resources > Develop data access applications > Develop data access applications > Data access with Service DataObjects, API versions 1.0 and 2.01 > EJB Data Mediator Service
XREL keyword
The XREL keyword is used to build relationships independent of how the data was retrieved. XREL is valid only in EJB Mediator queries.
XREL does not retrieve additional data, it only builds relationships from data already retrieved by the select statements. The relationships can be one-to-one, one-to-many, many-to-one, or many-to-many. The relationships can be unidirectional or bidirectional. If you specify a bidirectional relationship in an XREL, the inverse relationship is also established in addition to the specified relationship.
xrel := XREL identification_variable . { single_valued_cmr_field | collection_valued_cmr_field } [ , identification_variable . { single_valued_cmr_field | collection_valued_cmr_field } ]*
Examples: XREL keyword
This example retrieves all employees and all departments, and establishes the emps and mgr relationships.
select e.name from EmpBean e select d.name from DeptBean d xrel d.emps, d.mgrNotice that the employees are retrieved through d.emps relationship, xrel d.mgr is to establish the mgr relationship for those employees who are also a manager.select d.name from DeptBean d select e.name from in(d.emps) e xrel d.mgr
EJB query language
Use EJB query
Use the dynamic query service