The <generatedKey> Element

The <generatedKey> element is used to specify properties for auto generated keys (from identity field or sequences). If you specify this element, Abator will generate an appropriate <selectKey> element inside the generated <insert> element in the SQL map. This element is an optional child element of the <table> element.

Required Attributes

Attribute Description
column The column name of the generated column.
sqlStatement The SQL statement that will return the new value. If this is an identity column, then you can use one of the predefined special values, or substitute the proper statement for your database. The predefined special values are as follows:
Cloudscape This will translate to VALUES IDENTITY_VAL_LOCAL()
DB2 This will translate to VALUES IDENTITY_VAL_LOCAL()
Derby This will translate to VALUES IDENTITY_VAL_LOCAL()
HSQLDB This will translate to CALL IDENTITY()
MySql This will translate to SELECT LAST_INSERT_ID()
SqlServer This will translate to SELECT SCOPE_IDENTITY()
identity If true, then the generated <selectKey> element will be placed after the insert (for an identity column). If false, then the generated <selectKey> will be placed before the insert (typically for a sequence).

Optional Attributes

None

Child Elements

None