Update of /cvsroot/webware/Webware/MiddleKit/Docs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10534/Docs
Modified Files:
RelNotes-X.Y.html TODO-MiddleKit.text
Log Message:
Added assertion checks to detect when a changed object is about to be
refreshed from the database (changes would be lost). See release notes for
details.
In order to detect this reliably I tweaked the logic in the generated code
which sets MiddleObject._mk_changed, so that it only gets set when an attribute
actually changes. Hopefully this doesn't break anyone's logic, but IMO the
old semantics for this flag were pretty much useless, and this needs to be
fixed at some point.
Index: RelNotes-X.Y.html
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Docs/RelNotes-X.Y.html,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** RelNotes-X.Y.html 12 Mar 2004 23:46:11 -0000 1.17
--- RelNotes-X.Y.html 27 Mar 2004 21:04:18 -0000 1.18
***************
*** 38,41 ****
--- 38,42 ----
'SQLSerialColumnName': '%(className)sId',
'UseBigIntObjRefColumns': True,
+ 'AllowRefreshOfChangedObjects': True,
}</pre>
<li> If your model has a SQLGenerator.config file, move its contents to Settings.config.
***************
*** 71,74 ****
--- 72,93 ----
<p> The serial primary key field is now typed as int instead of bigint. This matches the MiddleKit approach for other databases and also allows object id columns to be foreign keys to this primary key (MS SQL will give an error if an int column tries to reference a bigint column).
+ <h3>Protection against losing changes</h3>
+ <p>
+ Depending on the application, certain call sequences can cause uncommitted changes to be lost. This might be due to
+ programmer error (i.e. forgetting to call saveChanges when necessary), but can also happen due to the implementation
+ of store.deleteObject(), which executes SQL queries (and refreshes objects) when locating and resolving object
+ references (i.e. cascade, detach).
+ </p>
+
+ <p>In order to protect the programmer against such errors, which may be
+ very subtle and difficult to detect, MiddleKit will raise an assertion
+ error when a changed object's attributes are about to be refreshed from
+ the database. The programmer should then add calls to store.saveChanges()
+ to ensure that data loss cannot occur. </p>
+
+ <p> Since this change may break existing applications, a new setting
+ called "AllowRefreshOfChangedObject" has been added. This setting defaults
+ to false (strongly recommended), but for existing applications you may
+ set it to true to avoid ever getting an assertion failure. </p>
<h2>New Features</h2>
Index: TODO-MiddleKit.text
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Docs/TODO-MiddleKit.text,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** TODO-MiddleKit.text 24 Mar 2004 07:46:27 -0000 1.38
--- TODO-MiddleKit.text 27 Mar 2004 21:04:18 -0000 1.39
***************
*** 103,106 ****
--- 103,109 ----
Also see the comment in MiddleObject.referencingObjectsAndAttrs().
+ @@jdh: This issue is mitigated by new assertion checking which ensures
+ that changed objects are not refreshed. See release notes for more details.
+
[ ] fetchObject*() refreshes the attributes of the objects in question, even if they were modified. eg, you could lose your changes
|