+

Search Tips   |   Advanced Search

 

Metadata for the Data Mediator Service

 

A Data Mediator Service (DMS) is the Service Data Object (SDO) component that connects to the back end database. It is created with back end specific metadata. The metadata defines the structure of the DataGraph that is produced by the DMS as well as the query to be used against the back end.

Metadata is composed of the following components:

metadata

Table

This represents a table within the target database and is composed of the following items:

Name

This is the database table name. A table might also have a property name that can be used to specify the name of the DataObject that corresponds to this table. By default, the property name is the same as the table name.

Columns

The subset of database table columns to return from the database. A column has a type that corresponds to a JDBC type and it can prohibit null entries. A column has a name that corresponds to the name in the database and an optional property name that identifies the column name in the DataObject. By default, the property name is the same as the column name in the database.

Primary Key

The column (or columns) used to uniquely identify a row within the table.

Keys may be composed of multiple columns. The following example illustrates creation of a compound primary key :

Key pk = MetadataFactory.eINSTANCE.createKey(); pk.getColumns().add(xColumn); pk.getColumns().add(yColumn); coordinateTable.setPrimaryKey(pk); 
If a table is related to this one and is the child table, it uses the same method to create the foreign key to point to this coordinate table.

Foreign Key

The column (or columns) used to relate the table to another table in the metadata. There is an assumed positional mapping between compound primary keys and foreign keys. For example, if a parent table has a primary key such as (x,y) with respective types (integer, string), then it is expected that any pointing foreign key is also (x', y') with respective types (integer, string).

Keys may be composed of multiple columns. The following example illustrates the creation of a compound foreign key :

Key fk = MetadataFactory.eINSTANCE.createKey(); fk.getColumns().add(xColumn); fk.getColumns().add(yColumn); coordinateTable.getForeignKeys().add(fk);
If a table is related to this one and is the child table, it uses the same method to create the foreign key to point to this coordinate table.

Filter

A structured query language (SQL) WHERE clause predicate that can be given with or without parameters to fill in later. This is added to the DataGraph SELECT statement WHERE clause. It is not parsed or interpreted in any way; it is used as is. If given with parameters to fill in later, these parameters become arguments passed into the JDBC DMS when getting the DataGraph. Filters are used with generated queries only. If a supplied query is given, the metadata filters are ignored.

Relationship

Relates two tables through the primary key of the parent table and the foreign key of the child table. Relationships are composed of the following items:

Name

This is the name given to the relationship, usually associated with how the two tables are related. If Customers is the parent table and Orders is the child table, then the default name of the relationship is Customers_Orders.

Opposite Name

This is the name used to navigate from the child DataObject to the parent DataObject.

Parent Key

The primary key of the parent table.

Child Key

The foreign key of the child table that points to the parent key.

Exclusive

By default, a Relationship causes the generated query to use an inner join operation on the two tables involved in the relationship. This means that it only returns the parent entries that have children, that is, child entries pointing to them. If the value of the Exclusive attribute is set to false, the query uses a left outer join operation instead and returns all parent entries, even those without children.

Ordering

Columns used for ordering the tables. Can be either ascending or descending. When specified, this causes generated queries to contain an ORDER BY clause.