* Do not mark prototype as updated in database when modifying the

_prototype property on transient objects. Fixes bug 572. 
  <http://helma.org/bugs/show_bug.cgi?id=572>
* Tentative fix for bug 573: Calling HopObject.persist() on already persistent
  object causes object to be updated in database.
  <http://helma.org/bugs/show_bug.cgi?id=573>
This commit is contained in:
hns 2007-11-22 10:27:04 +00:00
parent 1b873d3e11
commit 7258b95fcb

View file

@ -2093,7 +2093,7 @@ public final class Node implements INode, Serializable {
} }
// check if the property we're setting specifies the prototype of this object. // check if the property we're setting specifies the prototype of this object.
if (dbmap.getPrototypeField() != null && if (state != TRANSIENT &&
propname.equals(dbmap.columnNameToProperty(dbmap.getPrototypeField()))) { propname.equals(dbmap.columnNameToProperty(dbmap.getPrototypeField()))) {
DbMapping newmap = nmgr.getDbMapping(value); DbMapping newmap = nmgr.getDbMapping(value);
@ -2557,7 +2557,12 @@ public final class Node implements INode, Serializable {
* Public method to make a node persistent. * Public method to make a node persistent.
*/ */
public void persist() { public void persist() {
makePersistable(); if (state == TRANSIENT) {
makePersistable();
} else if (state == CLEAN) {
markAs(MODIFIED);
}
} }
/** /**