From 27a31bd73683bfd975e658ccb2015aadc22f2e24 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 16 Jun 2005 17:45:56 +0000 Subject: [PATCH] Do not try to set DbMapping in Node.setPrototype() - it has disastrous effects for prototyped groupby nodes. --- src/helma/objectmodel/db/Node.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/helma/objectmodel/db/Node.java b/src/helma/objectmodel/db/Node.java index 1dee1906..5745903e 100644 --- a/src/helma/objectmodel/db/Node.java +++ b/src/helma/objectmodel/db/Node.java @@ -89,8 +89,7 @@ public final class Node implements INode, Serializable { this.nmgr = nmgr; this.id = id; this.name = ((name == null) || "".equals(name)) ? id : name; - - setPrototype(prototype); + this.prototype = prototype; created = lastmodified = System.currentTimeMillis(); markAs(CLEAN); @@ -135,8 +134,8 @@ public final class Node implements INode, Serializable { */ public Node(String name, String prototype, WrappedNodeManager nmgr) { this.nmgr = nmgr; - - setPrototype(prototype); + this.prototype = prototype; + dbmap = nmgr.getDbMapping(prototype); // the id is only generated when the node is actually checked into db, // or when it's explicitly requested. @@ -550,10 +549,9 @@ public final class Node implements INode, Serializable { */ public void setPrototype(String proto) { this.prototype = proto; - // set DbMapping matching the prototype name - if (nmgr != null) { - dbmap = nmgr.getDbMapping(proto); - } + // Note: we mustn't set the DbMapping according to the prototype, + // because some nodes have custom dbmappings, e.g. the groupby + // dbmappings created in DbMapping.initGroupbyMapping(). } /**