emitMapping(pone, (JoinPathNd) one.getMapping(), 1);
emitMapping(pone, (JoinPathNd) one.getMapping(), 1, 2); emitMapping(pone.getReverse(), (JoinPathNd) two.getMapping(), 0, 1);
    private void emitMapping() {        m_ast.traverse(new Node.Switch() {                public void onIdentifier(IdentifierNd id) {                    ObjectTypeNd ot =                        (ObjectTypeNd) id.getParent().getParent();                    ObjectMap om = m_root.getObjectMap			(m_symbols.getEmitted(ot));                    om.getKeyProperties().add                        (m_symbols.getEmitted(ot).getProperty(id.getName()));                }            }, new Node.IncludeFilter(new Node.Field[] {                AST.FILES, FileNd.OBJECT_TYPES, ObjectTypeNd.OBJECT_KEY,                ObjectKeyNd.PROPERTIES            }));	m_ast.traverse(new Node.Switch() {		public void onAssociation(AssociationNd assn) {		    if (assn.getProperties().size() == 0) {			return;		    }		    PropertyNd one = assn.getRoleOne();		    PropertyNd two = assn.getRoleTwo();		    ObjectType ot = m_symbols.getEmitted(linkName(assn));		    ObjectMap om = m_root.getObjectMap(ot);		    Collection keys = om.getKeyProperties();		    Property pone = ot.getProperty(one.getName().getName());		    Property ptwo = ot.getProperty(two.getName().getName());		    keys.add(ptwo);		    keys.add(pone);		    if (one.getMapping() != null) {			emitMapping(pone, (JoinPathNd) one.getMapping(), 1);		    } else {			om.addMapping(new Static(Path.get(pone.getName())));		    }		    if (two.getMapping() != null) {			emitMapping(ptwo, (JoinPathNd) two.getMapping(), 1);		    } else {			om.addMapping(new Static(Path.get(ptwo.getName())));		    }		    String[] paths = new String[] { pone.getName(),						    ptwo.getName() };		    for (int i = 0; i < paths.length; i++) {			Mapping m = om.getMapping(Path.get(paths[i]));			if (m.getTable() != null) {			    om.setTable(m.getTable());			    break;			}		    }		}	    });	for (Iterator it = m_links.iterator(); it.hasNext(); ) {	    Link l = (Link) it.next();	    ObjectMap om = m_root.getObjectMap(l.getContainer());	    om.addMapping(new Static(Path.get(l.getName())));	}        m_ast.traverse(new Node.Switch() {                public void onProperty(PropertyNd pn) {                    Property prop = (Property) m_properties.get(pn);                    if (prop == null) { return; }                    ObjectMap om = m_root.getObjectMap(prop.getContainer());                    Object mapping = pn.getMapping();                    if (mapping == null) {                        om.addMapping(new Static(Path.get(prop.getName())));                    } else if (mapping instanceof ColumnNd) {                        emitMapping(prop, (ColumnNd) mapping);                    } else {                        emitMapping(prop, (JoinPathNd) mapping);                    }                }            });        m_ast.traverse(new Node.Switch() {                public void onReferenceKey(ReferenceKeyNd rkn) {                    Column key = lookup(rkn.getCol());                    ObjectMap om = getMap(rkn);                    om.setTable(key.getTable());                }                public void onObjectKey(ObjectKeyNd okn) {                    ObjectMap om = getMap(okn);                    IdentifierNd prop =                        (IdentifierNd) okn.getProperties().iterator().next();                    Mapping m = om.getMapping(Path.get(prop.getName()));                    if (m != null) {                        om.setTable(m.getTable());                    }                }            });	m_ast.traverse(new Node.Switch() {		public void onReferenceKey(ReferenceKeyNd rkn) {		    Column key = lookup(rkn.getCol());		    ObjectMap om = getMap(rkn);		    Column[] cols = new Column[] {key};		    if (key.getTable().getForeignKey(cols) == null) {			ObjectMap sm = om.getSuperMap();			Table table = null;			while (sm != null) {			    table = sm.getTable();			    if (table != null) {				break;			    }			    sm = sm.getSuperMap();			}			if (table == null) {			    throw new IllegalStateException				("unable to find supertable");			}			fk(cols, table.getPrimaryKey());		    }		}	    });	propogateTypes();/*        m_ast.traverse(new Node.Switch() {                public void onJoin(JoinNd nd) {                    ObjectMap om = m_root.getObjectMap                        (m_symbols.getEmitted                         ((ObjectTypeNd) nd.getParent().getParent()));                    om.addJoin(new Join(lookup(nd.getFrom()),                                        lookup(nd.getTo())));                }            }, new Node.IncludeFilter(new Node.Field[] {                AST.FILES, FileNd.OBJECT_TYPES, ObjectTypeNd.JOIN_PATHS,                JoinPathNd.JOINS                }));*/        m_ast.traverse(new Node.Switch() {                public void onIdentifier(IdentifierNd nd) {                    ObjectMap om = m_root.getObjectMap                        (m_symbols.getEmitted                         ((ObjectTypeNd) nd.getParent().getParent()                          .getParent()));                    om.addFetchedPath(Path.get(nd.getName()));                }            }, new Node.IncludeFilter(new Node.Field[] {                AST.FILES, FileNd.OBJECT_TYPES, ObjectTypeNd.AGGRESSIVE_LOAD,                AggressiveLoadNd.PATHS, PathNd.PATH            }));    }