Make createNode smarter about the prototype for the new child node it is

about to create. Otherwise, if called on a persistent node, the new child node
will be persisted with a possibly bogus id.
This commit is contained in:
hns 2004-03-23 14:32:28 +00:00
parent 1271379eda
commit 7991f133d5

View file

@ -984,7 +984,19 @@ public final class Node implements INode, Serializable {
anon = true;
}
Node n = new Node(nm, null, nmgr);
String proto = null;
// try to get proper prototype for new node
if (dbmap != null) {
DbMapping childmap = anon ?
dbmap.getSubnodeMapping() :
dbmap.getPropertyMapping(nm);
if (childmap != null) {
proto = childmap.getTypeName();
}
}
Node n = new Node(nm, proto, nmgr);
if (anon) {
addNode(n, where);