Hey Mike!

On 17/May/2010, at 4:24 PM, Mike Schrag wrote:
> so here's your challenge ... make this fail with an optimistic lock exception 
> when EC2 saves (which is what would happen if EC1 was in another instance):

But that's the point...  When an EO in your application changes, you are 
notified via the delegate!  You don't have to wait until you try to saveChanges 
and get the exception.  I agree with what others have posted recently on this 
topic, getting notified of a collision at the earliest point is much preferred!

As to the rest of it, I think that you're making it way too complicated...
My delegate works just fine at caching the changes and applying them later:

Attachment: MarksDelegate.java
Description: Binary data


This is what I've used in the past (since ObjC days) and I don't know of a case 
where it fails.
M.

P.S.  My run log looks like this (after the 100 objects are created):


May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT t0.id, 
RTRIM(t0.name) FROM Company t0" withBindings: >
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  - 100 row(s) processed
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Commit Internal 
Transaction
Application.Application: ec0 = er.extensions.eof.er...@7fd88db7
Application.Application: ec1 = er.extensions.eof.er...@524c71d2
Application.Application: ec2 = er.extensions.eof.er...@49198ff2
Application.Application: Company 98
Application.Application: Company 98
Application.Application: Company 98

C1 updated, not saved.
Application.Application: Company 98
Application.Application: C1 1274149686265
Application.Application: Company 98

C2 updated, not saved.
Application.Application: Company 98
Application.Application: C1 1274149686265
Application.Application: C2 1274149686265

May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Begin Internal 
Transaction
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE Company SET 
name = ? WHERE (id = ? AND name = ?)" withBindings: 1:"C1 1274149686265"(name), 
2:89(id), 3:"Company 98"(name)>
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Commit Internal 
Transaction
MarksDelegate.editingContext: er.extensions.eof.er...@49198ff2 
shouldMergeChangesForObject: eo = <your.app.eo.Company 2d397e5c 
_EOIntegralKeyGlobalID[Company (java.lang.Integer)89]>
MarksDelegate.editingContext: er.extensions.eof.er...@49198ff2 didMergeChanges:
MarksDelegate.editingContext: er.extensions.eof.er...@7fd88db7 
shouldInvalidateObject: eo = <your.app.eo.Company 51701bdc 
_EOIntegralKeyGlobalID[Company (java.lang.Integer)89]>
MarksDelegate.editingContext: er.extensions.eof.er...@7fd88db7 didMergeChanges:
MarksDelegate.editingContext: er.extensions.eof.er...@524c71d2 
shouldInvalidateObject: eo = <your.app.eo.Company 1c2006a0 
_EOIntegralKeyGlobalID[Company (java.lang.Integer)89]>
MarksDelegate.editingContext: er.extensions.eof.er...@524c71d2 didMergeChanges:
C1 saved.
Application.Application: C1 1274149686265
Application.Application: C1 1274149686265
Application.Application: C2 1274149686265

May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Begin Internal 
Transaction
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "UPDATE Company SET 
name = ? WHERE (id = ? AND name = ?)" withBindings: 1:"C2 1274149686265"(name), 
2:89(id), 3:"C1 1274149686265"(name)>
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Commit Internal 
Transaction
MarksDelegate.editingContext: er.extensions.eof.er...@524c71d2 
shouldInvalidateObject: eo = <your.app.eo.Company 1c2006a0 
_EOIntegralKeyGlobalID[Company (java.lang.Integer)89]>
MarksDelegate.editingContext: er.extensions.eof.er...@524c71d2 didMergeChanges:
MarksDelegate.editingContext: er.extensions.eof.er...@7fd88db7 
shouldInvalidateObject: eo = <your.app.eo.Company 51701bdc 
_EOIntegralKeyGlobalID[Company (java.lang.Integer)89]>
MarksDelegate.editingContext: er.extensions.eof.er...@7fd88db7 didMergeChanges:
MarksDelegate.editingContext: er.extensions.eof.er...@49198ff2 
shouldInvalidateObject: eo = <your.app.eo.Company 2d397e5c 
_EOIntegralKeyGlobalID[Company (java.lang.Integer)89]>
MarksDelegate.editingContext: er.extensions.eof.er...@49198ff2 didMergeChanges:
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Begin Internal 
Transaction
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  evaluateExpression: 
<com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression: "SELECT t0.id, 
RTRIM(t0.name) FROM Company t0 WHERE t0.id = ?" withBindings: 1:89(id)>
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  - 1 row(s) processed
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  -  === Commit Internal 
Transaction
C2 saved.
Application.Application: C2 1274149686265
Application.Application: C2 1274149686265
Application.Application: C2 1274149686265
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  - The URL for webserver 
connect is:
http://17.246.48.60/cgi-bin/WebObjects/UseTheDelegate.woa/-49584
The URL for direct connect is:
http://17.246.48.60:49584/cgi-bin/WebObjects/UseTheDelegate.woa
May 17 19:28:06 UseTheDelegate[49584] WARN  NSLog  - 
May 17 19:28:06 UseTheDelegate[49584] WARN  
er.extensions.appserver.ERXApplication  - You are running in development mode 
with WOAutoOpenInBrowser = false.  No browser will open and it will look like 
the application is hung, but it's not.  There's just not a browser opening 
automatically.
May 17 19:28:06 UseTheDelegate[49584] DEBUG NSLog  - Waiting for requests...

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to