app.logEvent ("inserting relational node: "+node.getID ());
    public void insertNode (IDatabase db, ITransaction txn, Node node) throws Exception {	Transactor tx = (Transactor) Thread.currentThread ();	// tx.timer.beginEvent ("insertNode "+node);	DbMapping dbm = node.getDbMapping ();	if (dbm == null || !dbm.isRelational ()) {	    db.saveNode (txn, node.getID (), node);	} else {	    app.logEvent ("inserting relational node: "+node.getID ());	    TableDataSet tds = null;	    try {	        tds = new TableDataSet (dbm.getConnection (), dbm.getSchema (), dbm.getKeyDef ());	        Record rec = tds.addRecord ();	        rec.setValue (dbm.getIDField (), node.getID ());	        String nameField = dbm.getNameField ();	        if (nameField != null)	            rec.setValue (nameField, node.getName ());	        for (Iterator i=dbm.getProp2DB().entrySet().iterator(); i.hasNext(); ) {	            Map.Entry e = (Map.Entry) i.next ();	            String propname = (String) e.getKey ();	            Relation rel = (Relation) e.getValue ();	            Property p = node.getProperty (propname, false);	            if (p != null && rel != null) {	                switch (p.getType ()) {	                    case IProperty.STRING:	                        rec.setValue (rel.getDbField(), p.getStringValue ());	                        break;	                    case IProperty.BOOLEAN:	                        rec.setValue (rel.getDbField(), p.getBooleanValue ());	                        break;	                    case IProperty.DATE:	                        Timestamp t = new Timestamp (p.getDateValue ().getTime ());	                        rec.setValue (rel.getDbField(), t);	                        break;	                    case IProperty.INTEGER:	                        rec.setValue (rel.getDbField(), p.getIntegerValue ());	                        break;	                    case IProperty.FLOAT:	                        rec.setValue (rel.getDbField(), p.getFloatValue ());	                        break;	                    case IProperty.NODE:	                        if (rel.reftype == Relation.REFERENCE) {	                            // INode n = p.getNodeValue ();	                            // String foreignID = n == null ? null : n.getID ();	                            rec.setValue (rel.getDbField(), p.getStringValue ());	                        }	                        break;	                }	                p.dirty = false;	            } else if (rel != null && rel.getDbField() != null) {	                rec.setValueNull (rel.getDbField());	            }	        }		        if (dbm.getPrototypeField () != null) {	            rec.setValue (dbm.getPrototypeField (), node.getPrototype ());	        }	        rec.markForInsert ();	        tds.save ();	    } finally {	        if (tds != null) try {	            tds.close ();	        } catch (Exception ignore) {}	    }	    dbm.notifyDataChange ();	}	// tx.timer.endEvent ("insertNode "+node);    }