You are here:
Entities
Use entities to specify the tables to fetch the data columns from.
Required Editions
| Available in: Enterprise, Performance, and Unlimited Editions |
You can use one or more entities in a datasource contract but you can specify only one of the
entities as the main or editable entity in the DataSource element. Then, you can use the
Join element to define additional entities.
To map object properties to the columns of the editable entities, you can also define editableEntity in the root node of external datasource
contracts.
<Entities>
<Entity name="PrdProduct" alias="" idAttribute="PKey" />
</Entities>
The Entities element has no attributes, it contains only
the Entity element. Use these attributes to define an
Entity element.
| Attribute | Description | Value | Required |
|---|---|---|---|
name
|
Specifies the unique name of the entity or database table. | — | Yes |
alias
|
When you use the same entity or database table more than once in the datasource contract, use the alias attribute to distinguish the specific usages from each other. | — | Yes, if the same database table is usedmore than once. |
idAttribute
|
If the entity is an editable entity, use this attribute to specify the column to make this a unique record in the database, such as id or pKey. For example, |
Name of a table attribute. | Yes, if the entity is specified in editableEntity in DataSource. |
Within an Entity element, use the Join element to specify the type of join clause between two
entities. Supported types of join clauses are inner, left, and outer. For example,
<Entity name="PrdProposalAuthListBpaCategoryModule" alias="" >
<Join Type="inner">
</Join>
</Entity>
To define additional relations between entities in a Join element, you can use SimpleJoin with
conditions and ComplexJoin nodes.
SimpleJoin- Use to specify one or more modeled relations between entities that are matched using a comparison operator.For example,
<Join Type="inner"> <SimpleJoin> <Condition leftSideValue="PrdProposalAuthListPrdRel.Category" comparator="eq" rightSideType="Attribute" rightSideValue="PrdProposalAuthListBpaCategoryModule.Category" /> <Condition leftSideValue="PrdProposalAuthListPrdRel.ListingModule" comparator="eq" rightSideType="Attribute" rightSideValue="PrdProposalAuthListBpaCategoryModule.ListingModule" /> <Condition leftSideValue="PrdProduct.PKey" comparator="eq" rightSideType="Attribute" rightSideValue="PrdLogisticAbstract.ProductPKey" /> </SimpleJoin> </Join>ComplexJoin- Use to specify the relation between entities with a SQL code snippet. ComplexJoin nodes contain only a CDATA section with the SQL code.Example 1
<Join Type="inner"> <ComplexJoin> <![CDATA[ PrdSales.#criterionAttribute# = PrdGroup.Id #addCond_criterionFilterValue# ]]> </ComplexJoin> </Join>Example 2
<ComplexJoin> <![CDATA[ (IvcTAMeta.TaControl <> 'Neutral' OR IvcTAMeta.TaType = 'Balance') ]> </ComplexJoin>

