private boolean isTable(Object key) throws HibernateException { // BIG HACK - should probably utilize the table cache before going to the jdbcreader :( if (key instanceof String) { String[] strings = StringHelper.split(".", (String) key); if (strings.length == 1) { tableSelector.clearSchemaSelections(); tableSelector.addSchemaSelection(new SchemaSelection(null, null, strings[0])); List list = reader.readDatabaseSchema(dbc, null, null); return !list.isEmpty(); } else if (strings.length == 3) { tableSelector.clearSchemaSelections(); tableSelector.addSchemaSelection(new SchemaSelection(strings[0], strings[1], strings[2])); List list = reader.readDatabaseSchema(dbc, null, null); return !list.isEmpty(); } else if (strings.length == 2) { tableSelector.clearSchemaSelections(); tableSelector.addSchemaSelection(new SchemaSelection(null, strings[0], strings[1])); List list = reader.readDatabaseSchema(dbc, null, null); return !list.isEmpty(); } } return false; }
private void setSchemaSelection(Table table) { tableSelector.clearSchemaSelections(); tableSelector.addSchemaSelection( new SchemaSelection(table.getCatalog(), table.getSchema(), table.getName())); }