Sequential Guids and refetchAfterSave

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 25-Jan-2010 15:59:51   

I have a simple entity whose PK is a Sequential Guid. The Database creates the PK.

When I save a new'd entity and ask the adapter to refetchAfterSave the SQL it generates is "Select blah from blah where PK is null" so of course does not refetch.

How can I get the entity I just new'd and saved when the PK is a DB generated Sequential Guid?

Ian

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Jan-2010 03:48:52   
  • What DB are you using?
  • In case you are using SQLServer are you setting the compatibility level in your config file?
  • Is such field marked as "IsIdentity" in LLBLGen Designer.
David Elizondo | LLBLGen Support Team
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 26-Jan-2010 13:53:21   

SQL 2005, compatibility level is what ever is default.

Field is as shown in attached screen grab.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 26-Jan-2010 20:54:03   

Can you show us the code you are using to create and save the entity ?

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39865
Joined: 17-Aug-2003
# Posted on: 27-Jan-2010 10:32:04   

Use as default on the field: NEWSEQUENTIALID(), which is a new feature introduced in sqlserver 2005. See also the documentation about NEWSEQUENTIALID()

Frans Bouma | Lead developer LLBLGen Pro