Yes, so that worked. I have 2 methods in my derby MetaDataDialect
Code:
protected void putTablePart(Map element, ResultSet tableRs) throws SQLException {
super.putTablePart(element, tableRs);
element.put("TABLE_CAT", null);
}
Which turns out to be not needed because the catalog (and schema) are set to null if they are blank (trimmed string length = 0)
and
Code:
protected void putExportedKeysPart(Map element, ResultSet rs) throws SQLException {
super.putExportedKeysPart(element, rs);
element.put( "PKTABLE_CAT", null); // instead of "", which derby returns.
element.put( "FKTABLE_CAT", null);
}
Which actually fixed it. I think an actual production version should check if it is blank and set it to null then; just in case derby started supporting catalogs.
But, I think the null/blank thing should be handled elsewhere, like line 197 in processForeignKeys() of JDBCReader.java. This would be congruent to how processTables() works.
Shall I put this in jira? or is this a known problem that I didn't find?
Incidentally, I found another interesting thing: in my reverse engineering strategy class, I needed to do this:
Code:
public void configure(ReverseEngineeringRuntimeInfo runtimeInfo) {
super.configure(runtimeInfo);
this.runtimeInfo = runtimeInfo;
}
Otherwise, a null-pointer-exception is thrown when getting the runtime info via the parent (default reverse engineering strategy). This is not a big deal, the only reason I found this strange is that its friend, setSettings() didn't need it, since the JDBCReader calls setSettings() on both the user defined one and the default. It should probably do the same for configure().
By the way, I didn't run into this last time I tried this (earlier this year). I think because I was using DB2, which is down at the moment, so I can't verify.