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.
In the Attributes page, click New.
Specify attribute settings to define:
a new transient entity attribute
a new persistent entity attribute for forward generation
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 |
|
N/A |
Default based on column name; you can change it to any Java identifier name. |
Required |
Required |
|
|
N/A |
Default based on column data type; you can choose another type in the list. |
Required |
Required |
|
|
N/A |
N/A |
Optional |
Optional |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
N/A |
N/A |
Selectable |
Selectable |
|
|
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 |
|
|
Becomes the table's column name |
From the table; it must match the table. |
Required; it must match the table. |
N/A |
|
|
Becomes the table's column data type |
From the table; it must match the table. |
Required; it must match the table. |
N/A |
|
|
N/A |
N/A |
Selectable |
N/A |
|
|
If selected, the column has a unique constraint. |
From the table; it must match the table. |
Selectable |
N/A |
|
|
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.