Show Table of Contents
Chapter 11. DDL Metadata
11.1. DDL Metadata
A VDB can define models/schemas using DDL. Here is a small example of how one can define a view inside the
-vdb.xml file. See the <metadata> element under <model>.
Example 11.1. Example to show view definition
<model visible = "true" type = "VIRTUAL" name = "customers">
<metadata type = "DDL"><![CDATA[
CREATE VIEW PARTS (
PART_ID integer PRIMARY KEY,
PART_NAME varchar(255),
PART_COLOR varchar(30),
PART_WEIGHT varchar(255)
) AS
select a.id as PART_ID, a.name as PART_NAME, b.color as PART_COLOR, b.weight as PART_WEIGHT from modelA.part a, modelB.part b where a.id = b.id
]]>
</metadata>
</model>
Another complete DDL based example is at the end of this section.
Note
The declaration of metadata using DDL,
NATIVE or DDL-FILE is supported out of the box, however the MetadataRepository interface allows users to plug-in their own metadata facilities. For example, you can write a Hibernate based store that can feed the necessary metadata. You can find out more about custom metadata repositories in Red Hat JBoss Data Virtualization Development Guide: Server Development.
Note
The DDL based schema is not constrained to be defined only for the view models.
Note
The full grammar for DDL is in the appendix.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.