Transaction Name Need to Be Unique?

Posts   
 
    
ScottCate
User
Posts: 48
Joined: 11-May-2005
# Posted on: 14-Oct-2005 03:31:35   

Is it important that a transaction name is unique?

 adapter.StartTransaction(IsolationLevel.ReadCommitted, 
  "MyEntity-"+myEntity.EntityId.ToString()
);

or is

adapter.StartTransaction(IsolationLevel.ReadCommitted, "MyEntity");

ScottCate
User
Posts: 48
Joined: 11-May-2005
# Posted on: 14-Oct-2005 03:35:17   

after running my code sample, i got the following error.

The identifier that starts with 'SaveEntity-d3707774-c6a8-4a36-ba4e-391dc30e6487' is too long. Maximum length is 32. 

So now I know the answer, and since there isn't any nesting, this makes sense to me.

So now my question is, why have any name? Possibly to address the transaction while in the middle? Doesn't seem to make sense to have a name, if there is no nesting.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Oct-2005 09:45:23   

A name given is always suffixed with a unique key by the db server, so a name doesn't have to be unique. When a transaction deadlocks or for some other reason creates havoc inside the db server which might trigger logging, you can easily spot, if you use descriptive names, what the transaction is all about and where it might have been created (in code).

So the names aren't useless without nesting simple_smile

Frans Bouma | Lead developer LLBLGen Pro
ScottCate
User
Posts: 48
Joined: 11-May-2005
# Posted on: 14-Oct-2005 15:27:06   

Thank you, i figured there was a good explination. flushed