try {
boolean supportsUnique = getNode().getAdapter().supportsUniqueConstraints();
boolean supportsLobs = getAccessStackAdapter().supportsLobs();
boolean supportsFK = getAccessStackAdapter().supportsFKConstraints();
DataMap map = new DataMap();
String tableLabel = getNode().getAdapter().tableTypeForTable();
// *** TESTING THIS ***
loader.loadDbEntities(map, loader.getTables(null, null, "%", new String[] {
tableLabel
}));
assertDbEntities(map);
if (supportsLobs) {
assertLobDbEntities(map);
}
// *** TESTING THIS ***
loader.loadDbRelationships(map);
if (supportsFK) {
Collection rels = getDbEntity(map, "ARTIST").getRelationships();
assertNotNull(rels);
assertTrue(rels.size() > 0);
// test one-to-one
rels = getDbEntity(map, "PAINTING").getRelationships();
assertNotNull(rels);
// find relationship to PAINTING_INFO
DbRelationship oneToOne = null;
Iterator it = rels.iterator();
while (it.hasNext()) {
DbRelationship rel = (DbRelationship) it.next();
if ("PAINTING_INFO".equalsIgnoreCase(rel.getTargetEntityName())) {
oneToOne = rel;
break;
}
}
assertNotNull("No relationship to PAINTING_INFO", oneToOne);
assertFalse("Relationship to PAINTING_INFO must be to-one", oneToOne
.isToMany());
assertTrue("Relationship to PAINTING_INFO must be to-one", oneToOne
.isToDependentPK());
// test UNIQUE only if FK is supported...
if (supportsUnique) {
assertUniqueConstraintsInRelationships(map);
}
}
// *** TESTING THIS ***
loader.setCreatingMeaningfulPK(false);
loader.loadObjEntities(map);
ObjEntity ae = map.getObjEntity("Artist");
assertNotNull(ae);
assertEquals("Artist", ae.getName());
// assert primary key is not an attribute
assertNull(ae.getAttribute("artistId"));
if (supportsLobs) {