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 :
Index name On property_expression_list [ PrimaryKey ];
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.
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 :
thank you,
Id1 still exists,Is this code correct?
Yes your code is correct.
Id1 still exist and it's sync with id.
When you index a new primary key, id will have that value. In your case Id1 is call as is because you name a column Id.
I think, you can't get rid off ID (Id1 in your case). Should ask an expert on that.
@Eduard Lebedyuk @Benjamin De Boe @Robert C. Cemper
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.
thank