else if ((state != TRANSIENT) && propRel.createOnDemand()) {  Node pn = nmgr.getNode(this, propname, propRel);  if (pn != null) { if ((pn.parentHandle == null) && !"root".equalsIgnoreCase(pn.getPrototype())) { pn.setParent(this); pn.name = propname; pn.anonymous = false; }  prop = new Property(propname, this, pn); } } } } else if (propRel != null && propRel.isVirtual()) {   Node pn = (Node) prop.getNodeValue(); if (pn != null) {  pn.setDbMapping(propRel.getVirtualMapping());   pn.nmgr = nmgr;
return new Property(propname, this, n);
    protected Property getProperty(String propname) {        // nmgr.logEvent ("GETTING PROPERTY: "+propname);        if (propname == null) {            return null;        }        Property prop = (propMap == null) ? null                                          : (Property) propMap.get(propname.toLowerCase());        // See if this could be a relationally linked node which still doesn't know        // (i.e, still thinks it's just the key as a string)        DbMapping pmap = (dbmap == null) ? null : dbmap.getExactPropertyMapping(propname);        if ((pmap != null) && (prop != null) && (prop.getType() != IProperty.NODE)) {            // this is a relational node stored by id but we still think it's just a string.            // Fix it.            prop.convertToNodeReference(pmap);        }        // the property does not exist in our propmap - see if we should create it on the fly,        // either because it is mapped to an object from relational database or defined as        // collection aka virtual node        if (dbmap != null) {            // the explicitly defined property mapping            Relation propRel = dbmap.getPropertyRelation(propname);            // property was not found in propmap            if (prop == null) {                // if no property relation is defined for this specific property name,                // use the generic property relation, if one is defined.                if (propRel == null) {                    propRel = dbmap.getPropertyRelation();                }                // so if we have a property relation and it does in fact link to another object...                if ((propRel != null) && (propRel.isCollection() ||                                          propRel.isComplexReference())) {                    // in some cases we just want to create and set a generic node without                    // consulting the NodeManager if it exists: When we get a collection                    // (aka virtual node) from a transient node for the first time, or when                    // we get a collection whose content objects are stored in the embedded                    // XML data storage.                    if ((state == TRANSIENT) && propRel.virtual) {                        Node pn = new Node(propname, propRel.getPrototype(), nmgr);                        pn.setDbMapping(propRel.getVirtualMapping());                        pn.setParent(this);                        setNode(propname, pn);                        prop = (Property) propMap.get(propname);                    }                    // if this is from relational database only fetch if this node                    // is itself persistent.                    else if ((state != TRANSIENT) && propRel.createOnDemand()) {                        // this may be a relational node stored by property name                        Node pn = nmgr.getNode(this, propname, propRel);                        if (pn != null) {                            if ((pn.parentHandle == null) &&                                    !"root".equalsIgnoreCase(pn.getPrototype())) {                                pn.setParent(this);                                pn.name = propname;                                pn.anonymous = false;                            }                            prop = new Property(propname, this, pn);                        }                    }                }            } else if (propRel != null && propRel.isVirtual()) {                // prop was found and explicit property relation is collection -                // this is a collection node containing objects stored in the embedded db                Node pn = (Node) prop.getNodeValue();                if (pn != null) {                    // do set DbMapping for embedded db collection nodes                    pn.setDbMapping(propRel.getVirtualMapping());                    // also set node manager in case this is a mountpoint node                    // that came in through replication                    pn.nmgr = nmgr;                }            }        }        return prop;    }