Dear Folks,
I am getting the error "Unsupported Operation: explicit locking in optimistic transactions" when i am trying to execute the statement
dbContext.Scope.Transaction.Lock(gdnItems, Telerik.OpenAccess.LockMode.READ);
Please find backend configurationsettings as below.
<BackendConfigurationSettings>
<BackendConfiguration>
<Backend>oracle</Backend>
<ProviderName>Oracle.DataAccess.Client</ProviderName>
<Runtime>
<Concurrency>PESSIMISTIC_EXPLICIT</Concurrency>
</Runtime>
<ConnectionPool>
<IsolationLevel>Serializable</IsolationLevel>
</ConnectionPool>
<Logging>
<MetricStoreSnapshotInterval>0</MetricStoreSnapshotInterval>
</Logging>
</BackendConfiguration>
The basic idea is i want to read/write lock certain rows in table manually.
Can anyone help me out the fix this problem.
Thanks,
Arun
5 Answers, 1 is accepted
I was able to reproduce the behavior you reported. This is a bug in the product, when working with the context. In order to achieve the scenario, you need to use the "old" scope approach.
Please see this link as a starting point for implementing this.
The reason is that the concurrency control setting provided in the BackendBonfiguration is not taken into account. Also you can not specify the TransactionProperties on a scope that is obtained from a context, because there you have already a running transaction that was created implicitly by the context.
I will add this to our backlog to have this addressed soon.
Please accept my apologies for the inconvenience caused so far and thank you for pointing this out.
Feel free to ask if you have any other question.
Ralph
the Telerik team
Thanks for your update.
Can you please let us know when we can expect this issue to be resolved. Since it is most important feature for any enterprise software development.
As you suggested does switching back to old version will resolve the problem ?. Can you please guide us how to achieve the below scenario using old version. The basic idea is we want to read/write lock certain rows in table manually.
Regards,
Arun
Attached you can find a sample solution that is using the "old" scope approach to fulfill your requirements.
See also the following example script.
class
Program
{
static
void
Main(
string
[] args)
{
using
(var scope = ObjectScopeProvider1.GetNewObjectScope())
{
scope.TransactionProperties.Concurrency = TransactionMode.PESSIMISTIC_EXPLICIT;
scope.Transaction.Begin();
var prods = scope.Extent<Product>().Where(x => x.Id == 1).Single();
scope.Transaction.Lock(prods, Telerik.OpenAccess.LockMode.WRITE);
scope.Transaction.Commit();
}
}
}
SELECT
"Price"
COL1,
"ProductName"
COL2,
"storeDate"
COL3
FROM
"Products"
WHERE
"ID"
= :p0
FOR
UPDATE
[:p0=1]
You can switch back to the "old" classic OpenAccess as described here.
Unfortunately, I can not give you an exact timeframe on when this is fixed for the context approach.
I will keep you updated on this.
Hope that helps.
Do come back if you have any other question.
All the best,
Ralph
the Telerik team
as long as you use the scope exclusive it is not nessesary to suround it with a lock.
Regards,
Jan Blessenohl
Telerik