# Defining a New Entity Attribute

While creating an entity object with the Entity Object Wizard or editing an entity object with the Entity Object Editor, you can add new attributes in the Attributes page.

#### To create an entity attribute:

1. In the Attributes page, click New.

2. Specify attribute settings to define:

   - a new transient entity attribute

   - a new persistent entity attribute for forward generation

3. Click OK.

Transient entity attributes are not persisted in the database, while persistent entity attributes are. To add a persistent attribute from an existing table, see Adding an Entity Attribute from a Table.

You can specify the following settings in the Define New Entity Attribute dialog box:

Attribute Setting | Forward Generation | Reverse Generation | Persistent Attribute | Transient Attribute
Attribute Name | N/A | Default based on column name; you can change it to any Java identifier name. | Required | Required
Attribute Type | N/A | Default based on column data type; you can choose another type in the list. | Required | Required
Default Value | N/A | N/A | Optional | Optional
Primary Key | Becomes the table's primary key, or part of it if you specify multiple primary keys for a table (a composite key) | From the table; it must match the table. | Selectable | Selectable, but you should leave it deselected in most cases
Mandatory | Becomes a mandatory column in the table (a NOT NULL constraint is generated for that column in the table). | From the table; this value must match the table, or you might get problematic runtime behavior or an exception. | Selectable | Selectable
Persistent | Only persistent attributes are added to the table. | All attributes derived from the table are persistent; if you change it, this column does not get populated through the business components framework. | Selected | Deselected
Updateable | N/A | N/A | Selectable | Selectable
Refresh After | N/A | N/A except when the java.sql.type for this attribute is CHAR, then all Refresh After checkboxes are selected. | Selectable | N/A
Database Column Name | Becomes the table's column name | From the table; it must match the table. | Required; it must match the table. | N/A
Column Type | Becomes the table's column data type | From the table; it must match the table. | Required; it must match the table. | N/A
Queriable | N/A | N/A | Selectable | N/A
Unique | If selected, the column has a unique constraint. | From the table; it must match the table. | Selectable | N/A
Change Indicator | N/A | N/A | Selectable | N/A

In general, for forward generation, the primary key, mandatory, persistent, database column name, column type, and unique settings are used to generate tables.