Database Metadata

From jVantage

Jump to: navigation, search

As you build applications using jVantage, jVantage automatically communicates with your database and builds a schema that is appropriate for your application. The approach and technique used by jVantage to create database schemas is extremely efficient.

It is possible to view the database meta information for a given table from within jVantage. This can be done from the table definition view by selecting the actions option from the relationship menu. The database metadata view is primarily for informational purposes, however, it does provide one important piece of functionality – it allows unique indexes to be created for your application tables. For instance, if, in your contact management application you want to ensure that there are no duplicate contact entries, you can create a unique key index based on the user's name. If a user then attempts to insert a duplicate name, jVantage will detect the condition and display a warning to the user that the form could not be validated because it violated the unique key constraint.

To create a unique index, select the edit indices hyperlink just below the index information on the database metadata view. From the Index builder page, select the new option. This causes a list of available fields from the associated entity to be display in the bottom portion of the screen. Select fields from the box on the last in order to chew it like them to appear in your unique index. As you select fields from the box on the left, the fields are automatically removed from the box and added to the box on the right. The box on the right shows which fields constitute your unique index. When you're finished, select the commit hyperlink at the bottom of the page. Note that if you're current state cannot be saved, the commit hyperlink will not be displayed. This can occur if an identical unique index already exists, or for other reasons that may be specific to the database you are using. After creating the unique index, the impact your application are immediate, meaning, the unique constrain will be enforced in your applications immediately.

If you receive an error when you attempt to commit (save) the unique index, it is almost certainly because data already exists in the underlying database table that violates the new unique key. In other words, if you already have two contacts with the same name in your contact table and you attempt to create a unique key constraint on the name, you will receive an error when you commit the new constraint.
Personal tools