# Code that Defines an Entity Constraint

While you are creating an entity constraint with the Entity Constraint Wizard, click Finish in the Finish page to create the entity constraint.

Entity constraints are business logic tier objects that represent database-level key constraints. These constraints enforce integrity and help define the relationship between database tables.

When an entity object is created from a database object, database keys (such as PRIMARY KEY, FOREIGN KEY, CHECK and UNIQUE) are detected and corresponding entity constraints are created automatically. These appear as properties in the Entity Object Wizard's Attribute Settings panel, and as keys in the Association Wizard's Attribute panels.

To create or modify key constraints, use the Entity Constraint Wizard to select the attributes that will participate in the key constraint definition, and then specify the type and details of the constraint. When database tables are forward-generated from business components, the corresponding key constraints are created in the database as well.