From 7258b95fcb406269d72324eca62a44e5c693f66f Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 22 Nov 2007 10:27:04 +0000 Subject: [PATCH] * Do not mark prototype as updated in database when modifying the _prototype property on transient objects. Fixes bug 572. * Tentative fix for bug 573: Calling HopObject.persist() on already persistent object causes object to be updated in database. --- src/helma/objectmodel/db/Node.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/helma/objectmodel/db/Node.java b/src/helma/objectmodel/db/Node.java index ca3fd9c9..18cfccd7 100644 --- a/src/helma/objectmodel/db/Node.java +++ b/src/helma/objectmodel/db/Node.java @@ -2093,7 +2093,7 @@ public final class Node implements INode, Serializable { } // 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()))) { DbMapping newmap = nmgr.getDbMapping(value); @@ -2557,7 +2557,12 @@ public final class Node implements INode, Serializable { * Public method to make a node persistent. */ public void persist() { - makePersistable(); + if (state == TRANSIENT) { + makePersistable(); + } else if (state == CLEAN) { + markAs(MODIFIED); + } + } /**