From b9646ab20d8ac2c37e476719fbe007e479680cc5 Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 4 Feb 2004 17:34:58 +0000 Subject: [PATCH] Set DbMapping on group nodes stored in embedded DB. Otherwise, child nodes are not reachable by name after the application is restarted. --- src/helma/objectmodel/db/Node.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/helma/objectmodel/db/Node.java b/src/helma/objectmodel/db/Node.java index dbd804a1..79532f52 100644 --- a/src/helma/objectmodel/db/Node.java +++ b/src/helma/objectmodel/db/Node.java @@ -617,7 +617,7 @@ public final class Node implements INode, Serializable { public void setName(String name) { if ((name == null) || (name.trim().length() == 0)) { // use id as name - this.name = id; + this.name = id; } else if (name.indexOf('/') > -1) { // "/" is used as delimiter, so it's not a legal char return; @@ -892,8 +892,8 @@ public final class Node implements INode, Serializable { INode old = (INode) getChildElement(prop); if ((old != null) && (old != node)) { - // FIXME: we delete the existing node here, - // but actually the app developer should prevent this from + // FIXME: we delete the existing node here, + // but actually the app developer should prevent this from // happening, so it might be better to throw an exception. old.remove(); this.removeNode(old); @@ -989,7 +989,7 @@ public final class Node implements INode, Serializable { /** - * This implements the getChild() method of the IPathElement interface + * This implements the getChildElement() method of the IPathElement interface */ public IPathElement getChildElement(String name) { if (dbmap != null) { @@ -1007,7 +1007,12 @@ public final class Node implements INode, Serializable { if (state != TRANSIENT && rel.otherType != null && rel.otherType.isRelational()) { return nmgr.getNode(this, name, rel); } else { - return getNode(name); + INode node = getNode(name); + // set DbMapping for embedded db group nodes + if (node != null && rel.groupby != null) { + node.setDbMapping(dbmap.getGroupbyMapping()); + } + return node; } } @@ -1151,7 +1156,7 @@ public final class Node implements INode, Serializable { // set "groupname" property to value of groupby field node.setString("groupname", sid); - + node.setDbMapping(groupbyMapping); if (!relational) {