Strange error after installing 21-03-2006 update

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 05-Apr-2006 10:14:20   

This code was working fine

            If Not uow.AddForSave(Me, refetch:=True) Then
                Throw New JException.JAppException(String.Format("Save Failed: UnitOfWork rejected to add this ({0}) object because it's already added for Save.", Me.GetType.Name))
            End If

            uow.Commit(adapter, True)

After installing the 21-03-2006 LLBL update, the last line does commit the UoW object BUT the fields of the entity (Me) are OutOfSynch (although I am requesting to refetch ??)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 05-Apr-2006 10:30:57   

Could you enable tracing and see which queries are generated and if a refetch is indeed executed?

The core sort routine for recursive saves was rewritten though not the actual save routine, so it should still refetch if specified.

Also, is the entity actually dirty?

Frans Bouma | Lead developer LLBLGen Pro
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 05-Apr-2006 10:45:55   

The issue here is that my entity uses a SQL Insert-TRIGGER to generate its PK value. When the entity is NEW, its PK value has a default value "ASSET".

LLBL's re-fetch query issues the query using the PK value of the entity BEFORE that of the trigger.

My Options: Option 1: do not request a refetch when committing the UoW object

Option 2: do not use triggers (proparly your preferred option !!)

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Apr-2006 16:53:16   

Yeah I'd go for the don't use trigges simple_smile

By the way is the following thread related to this issue? (Guess who was the poster) http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1832