ナビゲーションプロパティ
In OData, a navigation property is a property on an entity that is itself either a single entity or list of entities.
A single-entity navigation property signifies a one-to-one relationship; for example, an OData service might allow a Product to have only one Category. In this service, Category might be a navigation property on Products.
An entity set navigation property signifies a one-to-many relationship; for example, many Products can belong in the same Category. In this service, Products might be a navigation property on Categories.
Modeling Navigation Properties
By default, the 本製品 models ナビゲーションプロパティ as separate views. The views are named in the format ParentTable_NavigationProperty. You can disable this behavior with NavigationPropertiesAsViews.
Working with Navigation Properties Relationally
Navigation properties in OData link related entities. Similarly, in a relational database, a foreign key serves to link tables. For example, a Product record might have a CategoryId column, which uniquely identifies what Category the Product belongs to. However, there is no requirement in OData that an entity must contain a foreign key reference to a related entity. This means sometimes you will get navigation properties without having a foreign key reference to that entity on the parent or back to the parent from the related entity. In cases without a foreign key reference, the navigation property's existence is the only thing that can be used to identify a relationship between the two entities.
Select
NavigationPropertiesAsViews is useful for accessing data in OData services that lack foreign key references. Likewise, it can be used to retrieve related entites that do not exist by themselves such as LineItems on an Invoice. See tables for more information on querying navigation properties.
Insert
The 本製品 supports OData deep inserts. See テーブル for more information on specifying navigation properties when you create an entity.
Querying Navigation Properties
For an example of working with a navigation property as a view, consider BusinessPartners. The BusinessPartners entity set has an Orders navigation property. The CData JDBC Driver for SAP ByDesign will display a view called BusinessPartners_Orders for this service. Retrieving data from BusinessPartners_Orders will display all of the Orders associated with a given BusinessPartner. The BusinessPartners_Orders view has a primary key made up of the primary key of the parent entity and the primary key of the related entity.