Nested Transactions

Posts   
 
    
scottsimms
User
Posts: 12
Joined: 13-Feb-2007
# Posted on: 13-Feb-2007 07:54:55   

Hello,

Firstly I am using LLBLGen Pro 2.0 with MS Access 2002.

I am interested to know if LLBLGen handles nested transactions, e.g. if I have:

Method A() {

    Start Trans();
    Call methodB(); 
    CommitTrans();

}

Method B() { Start Trans(); DoStuff(); CommitTrans(); }

Will LLBLGen only commit at the 'top level', i.e. MethodA (as MethodB is a nested transaction) - OR - do I need to manage this myself?

Thanks,

Scott.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 13-Feb-2007 09:01:55   

LLBLGen Pro use a feature that's called Transaction savepoints Check it out in the LLBLGen Pro manual "Using the gGenerated code ->Adapter/SelfServicing -> Transactions"

But unfortunatly, Microsoft Access doesn't support savepoints in transactions, so this feature is not supported when you use LLBLGen Pro with MS Access.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 13-Feb-2007 09:55:52   

ADO.NET doesn't support nested transactions, only on the DB level, so if the db supports nested transactions it can suppor them. Access doesn't so that's out of the question.

If you really want nested transactions, you've to use enterprise services to use COM+ transactions.

Frans Bouma | Lead developer LLBLGen Pro
scottsimms
User
Posts: 12
Joined: 13-Feb-2007
# Posted on: 13-Feb-2007 10:52:59   

OK, so when I call 'Commit' in MethodB, it will commit the work already performed in MethodA right?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 14-Feb-2007 10:36:06   

scottsimms wrote:

OK, so when I call 'Commit' in MethodB, it will commit the work already performed in MethodA right?

Not with COM+ transactions, which will actually 'fake' the commit and will suggest 'commit' instead of really commit the transaction, though with normal transactions, it will commit the whole transaction indeed.

Nested transactions are often rewritable as 2 separated non-nested transactions or a single transaction. As you;re using access, I'd look into rewriting this into a single transaction, for example dropping B's transaction entirely, or only starting a transaction if none is already in progress.

Frans Bouma | Lead developer LLBLGen Pro