log.debug( "Ignoring " + table + " as class since rev.eng. says it is a many-to-many" );
continue;
}
RootClass rc = new RootClass();
TableIdentifier tableIdentifier = TableIdentifier.create(table);
String className = revengStrategy.tableToClassName( tableIdentifier );
log.debug("Building entity " + className + " based on " + tableIdentifier);
rc.setEntityName( className );
rc.setClassName( className );
rc.setProxyInterfaceName( rc.getEntityName() ); // TODO: configurable ?
rc.setLazy(true);
rc.setMetaAttributes( safeMeta(revengStrategy.tableToMetaAttributes( tableIdentifier )) );
rc.setDiscriminatorValue( rc.getEntityName() );
rc.setTable(table);
try {
mappings.addClass(rc);
} catch(DuplicateMappingException dme) {
// TODO: detect this and generate a "permutation" of it ?
PersistentClass class1 = mappings.getClass(dme.getName());
Table table2 = class1.getTable();
throw new JDBCBinderException("Duplicate class name '" + rc.getEntityName() + "' generated for '" + table + "'. Same name where generated for '" + table2 + "'");
}
mappings.addImport( rc.getEntityName(), rc.getEntityName() );
Set processed = new HashSet();
PrimaryKeyInfo pki = bindPrimaryKeyToProperties(table, rc, processed, mapping, collector);
bindColumnsToVersioning(table, rc, processed, mapping);
bindOutgoingForeignKeys(table, rc, processed);
bindColumnsToProperties(table, rc, processed, mapping);
List incomingForeignKeys = (List) manyToOneCandidates.get( rc.getEntityName() );
bindIncomingForeignKeys(rc, processed, incomingForeignKeys, mapping);
updatePrimaryKey(rc, pki);
}