First page Back Continue Last page Graphics

Using Declarative Built-in Rules: Key Exists Validator


Notes:

Using a Key Exists Validator

The Key Exists validator checks whether a key exists based on a primary, alternate, or foreign key. It first checks the cache, thus finding rows not yet committed to the database, and then checks the database if the key is not found in the cache.

When you define a key exists validator, after you have selected the rule type in the Add Validation Rule dialog box, you also specify the following:

1. Validation Target Type: You can choose from Entity Object, View Object, or View Accessor. If you want the key exists validator to be used for all view objects that use this entity attribute, choose Entity Object.

2. If you have chosen the Entity Object target type, you select the Association Name from a drop-down list. If you have chosen either View Object or View Accessor, you select an entity attribute and the attribute of the target whose key you are searching, then click Add to add the attribute/target pair.

When you use a Key Exists validator, a <ExistsValidationBean> tag is added to the XML file.