· Jan 27, 2021

How use column (auto_increment)

How use column (auto_increment)?


Product version: IRIS 2020.1
Discussion (5)0
Log in or sign up to continue

Hi Yeung,

First how-to auto increment an integer, you can use this property :

Then, why you have ID1 in your table, because by default any persistent class have an column called ID who is an auto increment and indexed as a primary key.
You can overload this primary key by your own with this index :

IRIS will automatically create an auto-incrementing RowID and leverage it as the IdKey for you, so unless you want anything other than the default, you shouldn't define such a field or index explicitly. 

If all you want is control the name, take a look at the SqlRowIdName class parameter. If you need control over its behaviour, what you've set up is appropriate and you can leverage SqlRowIdPrivate to get rid of the default additional projection of the RowID. However, unless there's a good reason for controlling the IdKey, you should try to avoid overriding it as it may deprive you of certain practical features and efficiencies such as bitmap indices and an extent index.