Print Page | Close Window

How does IdeaBlade handle Identity columns

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=212
Printed Date: 11-Apr-2026 at 7:33am


Topic: How does IdeaBlade handle Identity columns
Posted By: Customer
Subject: How does IdeaBlade handle Identity columns
Date Posted: 12-Jul-2007 at 3:47pm

I would just like to ask about how the IdeaBlade handles Identity columns (AutoGenerated Numbers) set on the DB Table?

Does the OR Mapper detect this?




Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 3:48pm
Identity columns pose a special problem for IdeaBlade. When a business object that uses an identity column is first created, it is assigned a negative temporary id. Only when the business object gets saved to the database, does the database assign the business object its permanent id. The difficulty with this is that if the PersistenceManager wants to refetch the entity, it doesn't know what permanent id to use.

Devforce solves this problem with a clever approach. Rather than having the database assign the permanent id, we assign it ourselves. We do this be creating a "hole" in the id space. If the last number used by the id generator was 1356 (for example), we create a range of ids from 1357 to 1367 that we own and can't be used by any other user.

The Object Mapper is fully aware of Identity columns.




Print Page | Close Window