[odb-users] Optimistic Concurrency : ROWVERSION exception
Chew Kok Keng
ckokkeng at dso.org.sg
Sat May 18 02:06:23 EDT 2013
Pardon me for the missing subject
________________________________
From: Chew Kok Keng
Sent: Saturday, May 18, 2013 2:01 PM
To: odb-users at codesynthesis.com
Subject:
Hi,
I’m getting the following exception when I tried out ODB optimistic example
First-chance exception at 0x751a812f in driver.exe: Microsoft C++ exception: odb::mssql::database_exception at memory location 0x0015e8ec..
I’ve replaced the 2 lines in person class header with ROWVERSION type. See below.
//#pragma db version
//unsigned long version_;
#pragma db version type("ROWVERSION")
unsigned long long version_;
Here’s the line that the exception occurred.
try
{
db->update (p2); // exception thrown here
}
catch (const object_changed&)
{
cout << "process 2 version is out of date: " << p2.version () << endl;
// Reload the object and retry the operation. Note that the second
// update call cannot throw object_changed since we reloaded the
// object and are trying to update it in a single transaction.
//
db->reload (p2);
cout << "process 2 version after reload: " << p2.version () << endl;
p2.age (p2.age () + 1);
db->update (p2);
}
I’m uisng VC++ 2008 Express and SQl Server 2008 Express on windows 7 32bits. Could you let me know whether I’m doing anything wrong? or is this a genuine problem in ODB?
Thanks,
Chew
More information about the odb-users
mailing list