From babe14b16f85334d578577462ef7a2c3802fd4d5 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 21 Nov 2003 10:59:10 +0000 Subject: [PATCH] Reverse sequence of and in getProperty(). This may return old cached properties from the propmap when it shouldn't, but it fixes the much worse bug where embedded-db-collections are created from scratch again and again. --- src/helma/objectmodel/db/Node.java | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/helma/objectmodel/db/Node.java b/src/helma/objectmodel/db/Node.java index 09bf4660..ca6ee1fe 100644 --- a/src/helma/objectmodel/db/Node.java +++ b/src/helma/objectmodel/db/Node.java @@ -1618,24 +1618,7 @@ public final class Node implements INode, Serializable { null : dbmap.getExactPropertyRelation(propname); - // 1) check if this is a create-on-demand node property - if (rel != null && (rel.isVirtual() || rel.isComplexReference())) { - if (state != TRANSIENT) { - Node n = nmgr.getNode(this, propname, rel); - - if (n != null) { - if ((n.parentHandle == null) && - !"root".equalsIgnoreCase(n.getPrototype())) { - n.setParent(this); - n.name = propname; - n.anonymous = false; - } - return new Property(propname, this, n); - } - } - } - - // 2) check if the property is contained in the propMap + // 1) check if the property is contained in the propMap Property prop = propMap == null ? null : (Property) propMap.get(propname.toLowerCase()); @@ -1672,6 +1655,24 @@ public final class Node implements INode, Serializable { return (Property) propMap.get(propname.toLowerCase()); } + // 2) check if this is a create-on-demand node property + if (rel != null && (rel.isVirtual() || rel.isComplexReference())) { + if (state != TRANSIENT) { + Node n = nmgr.getNode(this, propname, rel); + + if (n != null) { + if ((n.parentHandle == null) && + !"root".equalsIgnoreCase(n.getPrototype())) { + n.setParent(this); + n.name = propname; + n.anonymous = false; + } + return new Property(propname, this, n); + } + } + } + + // 3) try to get the property from the database via accessname, if defined if (rel == null && dbmap != null && state != TRANSIENT) { rel = dbmap.getSubnodeRelation();