Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

11.2. Runtime Metadata Updates

Runtime updates via system procedures and DDL statements are by default ephemeral. They are effective across the cluster only for the currently running VDBs. With the next VDB start the values will revert to whatever is stored in the VDB. Updates may be made persistent by configuring an org.teiid.metadata.MetadataRepository.
An instance of a MetadataRepository can be installed via the VDB file.
In Designer based VDB, you can edit the vdb.xml file in the META-INF directory or use Dynamic VDB file as below.
<vdb name="{vdb-name}" version="1">
    <model name="{model-name}" type="VIRTUAL">
         <metadata type="{jboss-as-module-name}"></metadata>
    </model>
</vdb>
In the above code fragment, replace the {jboss-as-module-name} with a JBoss EAP module name that has library that implements the org.teiid.metadata.MetadataRepository interface and defines file "META-INF/services/org.teiid.metadata.MetadataRepository" with name of the implementation file.
The MetadataRepository repository instance may fully implement as many of the methods as needed and return null from any unneeded getter.

Note

It is not recommended to directly manipulate org.teiid.metadata.AbstractMetadataRecord instances. System procedures and DDL statements should be used instead since the effects will be distributed through the cluster and will not introduce inconsistencies.
org.teiid.metadata.AbstractMetadataRecord objects passed to the MetadataRepository have not yet been modified. If the MetadataRepository cannot persist the update, then a RuntimeException should be thrown to prevent the update from being applied by the runtime engine.

Note

The MetadataRepository can be accessed by multiple threads both during load (if using dynamic VDBs) or at runtime with DDL statements. Your implementation should handle any needed synchronization.