Defining a database table
Business object instances are typically java object representations of rows of a database table.
The addition of following columns to each database table is strongly suggested:
- Object ID
- Version number
The Object ID is used as a globally unique identifier of each row across all database tables (see caveat below). That is, every row in every table should have a different object value. It is typically defined as a VARCHAR field of 36 characters, and should be named "OBJ_ID". A unique constraint should be applied to the object ID column, but must NOT be part of the primary key.
The object ID value is automatically stored by the framework and/or the database layer.
KFS/Rice uses optimistic locking to provide concurrency control. Optimistic locking requires the use of a version number field, named "VER_NBR". On Oracle, the field is defined as a
NUMBER(8,0). On MySQL, the field is defined as a
DECIMAL(8). This column should NOT be part of the primary key.
Example Account table definition
Below is the definition of the simplified account table.