if (rel != null && rel.otherType != null) {
if (rel != null && rel.otherType != null && (rel.groupby != null || rel.accessName != null)) {
    protected Property getProperty(String propname) {        if (propname == null) {            return null;        }        Relation rel = dbmap == null ?                             null :                             dbmap.getExactPropertyRelation(propname);        // 1) check if the property is contained in the propMap        Property prop = propMap == null ? null :                        (Property) propMap.get(propname.toLowerCase());        if (prop != null) {            if (rel != null) {                // Is a relational node stored by id but things it's a string or int. Fix it.                if (rel.otherType != null && prop.getType() != Property.NODE) {                    prop.convertToNodeReference(rel.otherType);                }                if (rel.isVirtual()) {                    // property was found in propMap and is a collection - this is                    // a collection holding non-relational objects. set DbMapping and                    // NodeManager                    Node n = (Node) prop.getNodeValue();                    if (n != null) {                        // do set DbMapping for embedded db collection nodes                        n.setDbMapping(rel.getVirtualMapping());                        // also set node manager in case this is a mountpoint node                        // that came in through replication                        n.nmgr = nmgr;                    }                }            }            return prop;        } else if (state == TRANSIENT && rel != null && rel.isVirtual()) {            // When we get a collection 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, we just want to create and set a generic node without            // consulting the NodeManager about it.            Node n = new Node(propname, rel.getPrototype(), nmgr);            n.setDbMapping(rel.getVirtualMapping());            n.setParent(this);            setNode(propname, n);            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();            if (rel != null && rel.otherType != null) {                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);                }            }        }        // 4) nothing to be found - return null        return null;    }