This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi Guys, I have a table which is being used to generate primary id for many other tables and should have an increment of 1 for each new id. I have override the GeneratedId by following:
[ Transient ]
private Int32 _allocatedId;
public Int32 AllocatedId { set { _allocatedId = value ; } }
protected override object GeneratedId()
{ return _allocatedId;
} I am able to get the id but I also want to update the it with an increment of 1. How can I achieve the desire? Identity method of said table is default. I am using Oracle 11g / WinXP. Regards, DHV |
|
|
When you get an ID from your key table using SELECT (prior to setting AllocatedId), just issue an UPDATE statement as part of the same transaction. Be sure to use the FOR UPDATE modifier on your SELECT so as to ensure the select and update are atomic. By the way, the ability to get IDs from a table is built into LightSpeed -- check out the KeyTable identity method and see if this will save you from having to implement it yourself. |
|