Do not try to set DbMapping in Node.setPrototype() - it has disastrous effects for prototyped groupby nodes.

This commit is contained in:
hns 2005-06-16 17:45:56 +00:00
parent 8f4bfdd54b
commit 27a31bd736

View file

@ -89,8 +89,7 @@ public final class Node implements INode, Serializable {
this.nmgr = nmgr; this.nmgr = nmgr;
this.id = id; this.id = id;
this.name = ((name == null) || "".equals(name)) ? id : name; this.name = ((name == null) || "".equals(name)) ? id : name;
this.prototype = prototype;
setPrototype(prototype);
created = lastmodified = System.currentTimeMillis(); created = lastmodified = System.currentTimeMillis();
markAs(CLEAN); markAs(CLEAN);
@ -135,8 +134,8 @@ public final class Node implements INode, Serializable {
*/ */
public Node(String name, String prototype, WrappedNodeManager nmgr) { public Node(String name, String prototype, WrappedNodeManager nmgr) {
this.nmgr = nmgr; this.nmgr = nmgr;
this.prototype = prototype;
setPrototype(prototype); dbmap = nmgr.getDbMapping(prototype);
// the id is only generated when the node is actually checked into db, // the id is only generated when the node is actually checked into db,
// or when it's explicitly requested. // or when it's explicitly requested.
@ -550,10 +549,9 @@ public final class Node implements INode, Serializable {
*/ */
public void setPrototype(String proto) { public void setPrototype(String proto) {
this.prototype = proto; this.prototype = proto;
// set DbMapping matching the prototype name // Note: we mustn't set the DbMapping according to the prototype,
if (nmgr != null) { // because some nodes have custom dbmappings, e.g. the groupby
dbmap = nmgr.getDbMapping(proto); // dbmappings created in DbMapping.initGroupbyMapping().
}
} }
/** /**