Autonumbering fields inside Composite Primary Keys not supported

Topic updated 13-4-2007

The Table Template performs this validation. A table with a composite primary key containing an autonumbering field (identity / autonumber  /autoincrement fields, fields with sequences, etc.) makes the table item invalid.

AutonumberingInCompositeKey1

Having an autonumbering column is generally the best way of defining primary keys when using NHibernate. An autonumbering primary key are unique by itself. No extra columns are needed to make the primary key values unique. NHibernate does not allow the definition of composite primary keys that contain both:

An autonumbering column.
Other columns.

 

Workaround

Just remove the other columns from the Key, turning it into a single column primary key. This is required only at the Database Repository level in Genwise. However, it would be recommended to also do it in your database.

To turn the primary key in the Database Repository into a single field primary key follow these steps:

1.Go to the Database Repository and locate the table.
2.Find the primary key and double click it.
3.You will see that the PK contains more than one field, so it is composite.
4.Remove all fields that are not autonumbering. Autonumbering fields can be recognized by their icon: AutonumberingInCompositeKey2