I'm no expert in Flex and RIA development but i have implemented 
creating the ID on the client using the createUUID to generate a GUID 
which by all practible means it will be globally unique.

I found this to work well, plus it saves me ALL the hassle of 
generating a temporary ID and then get the real ID back after i post 
the results to the server.

I'm generating many updates and a lot of times i'm updating parent 
child relatinships so if I don't have the real ID ahead of time it 
would be a large amount of work to get the real parent id then go 
through all the children and update the reference key based on the 
temporary key assigned to it on the client... it's even hard to explain 
in a sentance or two.


Some pureist will think it's crazy to generate the key on the client, 
and I partly agree.  But if it works, it works.

You can also setup a method to request a block of unique IDS on from 
the server if you don't want to create it on the client itself.  This 
keeps your ID generation centrally controlled but you still have the 
benefits of knowing your IDs for particular updates before sending them 
to the server.

Some of it also depends on the ID types in your database.  I actually 
am now using GUIDs in a SQL Server database and not using identity 
increment values.  Even though my primary key indexes are a bit more 
fragmented i have not found a performance loss, just a bit larger 
database since i'm storing  a 16bit id value instead of a 4 bit integer 
value.

In my case i'm trying to build rapid applications and i generally have 
oen app and one database so generating IDs on the client is ok in my 
circumstance... maybe not the best for all.

--Scott



--- In [email protected], "arieljake" <[EMAIL PROTECTED]> wrote:
>
> I am wondering how people like to handle insertion of records in a
> RIAs for records that have a unique number field.
> 
> Do people determine the unique id on the client side and create the
> record, or do they do that server side and return the new ID number
> back to the client.
> 
> I prefer to do the MAX(id) check on the server in the database within
> a transaction, but I am realizing that doing it that way sort of
> forces me to block user interaction in the RIA until the ID is
> returned lest the user try to do something with that new record that I
> cannot support yet.
> 
> Thoughts? Thank you.
>


Reply via email to