From: Jason Hildebrand <jason@pe...> - 2002-11-06 20:11:35
The MiddleKit ObjectStore now keeps track of new objects, modified
objects and to-be-deleted objects on a per-thread basis. This prevents
the ObjectStore from trying to save the same changes twice, and prevents
the situation where one thread commits an object which a different
thread modified (and wasn't necessarily ready to commit).
This new tracking is enabled when your ObjectStore is in "Threaded"
mode, which is enabled by default. You can run in single-threaded mode
by adding the following line to the Settings.config file in your model
The behaviour of the following methods has changed:
- saveChanges() - now commits only objects which were modified by
the current thread
New ObjectStore methods:
- hasChangesForCurrentThread() - returns whether the store has any
uncommitted changes for the current thread
- saveAllChanges() - commits all added/modified/deleted objects to
the database, regardless of which thread made the changes. This could be
called on application exit just to be extra safe. When using MiddleKit
from WebKit, though, you be calling saveChanges() at the end of any
request which modifies MK objects, so I recommend putting "assert not
store.hasChangesForCurrentThread()" into your SitePage.sleep() method to
catch programming errors early.
For upgrading older MiddleKit applications, you'll probably want to
replace any calls to store.hasChanges() with
store.hasChangesForCurrentThread(). Nothing else should need to change.
Please report any problems to me.
Jason D. Hildebrand
Get latest updates about Open Source Projects, Conferences and News.