ORMEntityOutOfSyncException - Why?

Posts   
 
    
Posts: 40
Joined: 26-Nov-2004
# Posted on: 23-May-2005 15:59:08   

Hi Guys,

May be I have missed this in the documentation but why when using the Adapter model does the entity lose its data when saved?

I can think of a few reasons but is there an offical one simple_smile

Cheers

Gareth

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-May-2005 20:53:57   

The reason for the exception is that after a save, default constraints, triggers and other things can execute on the data of the entity. Therefore to be sure the entity IN the database is in sync with the data in the entity object in memory, the object is marked out of sync so you have to refetch it. In SelfServicing this is done automatically, in adapter you have to do that manually or specify a flag to SaveEntity to refetch it in one go simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 40
Joined: 26-Nov-2004
# Posted on: 23-May-2005 21:45:19   

Those where the exact reasons I came up with simple_smile

Thanks.

Lakeman
User
Posts: 12
Joined: 15-Mar-2004
# Posted on: 22-Jun-2005 23:03:14   

I get this exception right after fetching the entity.

Using the adaptor scenario, What I'm trying to do is:

Fetch an entity out of the database, do a bunch of database operations using a different adaptor, then fetch that same entity out again and compare the before and after to see if that entity changed.

When I fetch the entity the first time, the entity is just fine, but when I fetch it the second time, I get this exception when I access any of the fields.

Could it be that when I fetch it the second time that the entity wasn't found in the database, so it wasn't fetched?

-Brian

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 23-Jun-2005 11:48:41   

Correct, it wasn't found in the database the second time.

Frans Bouma | Lead developer LLBLGen Pro