# Adding, Editing, Removing, and Reordering Entity Validation Rules

While editing an entity object with the Entity Object Editor or editing entity attributes in the Attribute Editor, you can add, edit, remove, and reorder validation rules in the Validation page:

- Adding and Editing a Validation Rule — You can apply new rules at the entity object level, attribute level, or both.

- Removing a Validation Rule — You can remove rules you do not want.

- Reordering Validation Rules — Rules can be reordered within a level, which is useful when you have multiple validation rules per attribute and want to control the order of rule firing.

You can specify both validation rules and validation levels. A validation level indicates whether the rule is applied to the attribute level or the entity object level.

At runtime, attribute-level validation rules are invoked when the attribute value is modified through a generated setter method, or by the setAttribute method called on the entity object. The entity-level validation rules are invoked when the current row in the client's iterator changes from this entity object to the next; or during the commit cycle if an entity object is invalid; or by an explicit validate method call on the entity object.

Applying validation rules involves attaching code to an entity object. When you use the wizard (as opposed to writing everything by hand), the Business Components for Java framework generates XML, enabling you to customize rules without recompiling Java code.