Re: Exception Thrown when two people are editing the same record
Re: Exception Thrown when two people are editing the same record
- Subject: Re: Exception Thrown when two people are editing the same record
- From: Alex Johnson <email@hidden>
- Date: Wed, 13 Jul 2005 11:16:50 -0500
Hi --
The way I understand optimistic locking is that it affects the generated sql statements. So, if you have an entity:
<x-tad-bigger> Foo
- int pkey
- int lockedField
- int nonLockedField
</x-tad-bigger>
When you update an nonLockedField on an instance of Foo, the sql is something like:
update "foo"
set "non_locked_col"
to 7
where "pkey" = 1000001
and "locked_col" = 22;
Now, if user A changes the value of otherLockedField to 10 and then user B changes it to 11, the two statements will be:
-- User A:
update "foo"
set "locked_col"
to 10
where "pkey" = 1000001
and "locked_col" = 22;
-- User B:
update "foo"
set "locked_col"
to 11
where "pkey" = 1000001
and "locked_col" = 22;
However, since user A already changed "locked_col" to 10, user B's sql will fail to update the DB because there is no row that matches the
where clause. If they are on the same instance, I think user B's EO will be updated to have the correct value for "locked_col" in its snapshot ... but I'm not sure about that, since user B has changed that field. If they are on separate instances you will definitely get this situation.
Alex Johnson
|
| |
|||
|| | |
||
| | |
|| || |
||
\\ SITE 9 \\ SITE9.COM \\ 312.670.8469 \\
On Jul 12, 2005, at 12:32 PM, Robert Snyder wrote:
Hello,
We are running into an exception when two people are editing a record
and the second person saves the record. As I understood EOF and the
optimistic locking, if two people are editing a record and person A
saves the record, and then person B saves the record, both get saved,
but person B's edits override person A's changes. That does happen;
however, some times we get the following exception thrown.
Any help on why this exception is thrown would be appreciated.
## 2005-07-11 19:27:14 Etc/GMT ## DMSWOApplication.handleException
##
com.webobjects.eoaccess.EOGeneralAdaptorException:
updateValuesInRowDescribedByQualifier --
com.webobjects.jdbcadaptor.JDBCChannel method failed to update row in
database
at
com.webobjects.eoaccess.EODatabaseContext._exceptionWithDatabaseContextI
nformationAdded(EODatabaseContext.java:4676)
at
com.webobjects.eoaccess.EODatabaseContext.performChanges(EODatabaseConte
xt.java:6384)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingCo
ntext(EOObjectStoreCoordinator.java:415)
at
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.j
ava:3165)
at CourseMaintenance.saveAction(CourseMaintenance.java:665)
at sun.reflect.GeneratedMethodAccessor643.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAcces
sor.java:54)
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(
NSKeyValueCoding.java:1160)
at
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueFo
rKey(NSKeyValueCoding.java:1268)
at
com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1539)
at
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValu
eCoding.java:498)
at
com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementatio
n.valueForKeyPath(NSKeyValueCodingAdditions.java:212)
at
com.webobjects.appserver.WOComponent.valueForKeyPath(WOComponent.java:
1600)
at
com.webobjects.appserver._private.WOKeyValueAssociation.valueInComponent
(WOKeyValueAssociation.java:46)
at
com.webobjects.appserver._private.WOSubmitButton.invokeAction(WOSubmitBu
tton.java:59)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver._private.WOConditional.invokeAction(WOCondition
al.java:55)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:82)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComp
onentContent.java:31)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver._private.WOComponentContent.invokeAction(WOComp
onentContent.java:31)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver._private.WOConditional.invokeAction(WOCondition
al.java:55)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:82)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
at
com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCo
mponentReference.java:104)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
at
com.webobjects.appserver._private.WOComponentReference.invokeAction(WOCo
mponentReference.java:104)
at
com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction(WO
DynamicGroup.java:101)
at
com.webobjects.appserver._private.WODynamicGroup.invokeAction(WODynamicG
roup.java:110)
at
com.webobjects.appserver.WOComponent.invokeAction(WOComponent.java:945)
at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1166)
at
com.webobjects.appserver.WOApplication.invokeAction(WOApplication.java:
1375)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedPage(WOComponentRequestHandler.java:196)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedSession(WOComponentRequestHandler.java:287)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedApplication(WOComponentRequestHandler.java:322)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleReque
st(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleReques
t(WOComponentRequestHandler.java:435)
at
com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.jav
a:1306)
at
com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.
java:173)
at
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java
:254)
at java.lang.Thread.run(Thread.java:552)
Robert
____________________________________________
Robert Snyder, Director
World Campus Data Management Services
The Pennsylvania State University
105 Mitchell Building
University Park PA 16802
Phone: 814-865-0912 Fax: 814-865-4406
E-mail: email@hidden
URL: http://www.worldcampus.psu.edu
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden