private static void bindTables(List<?> tables, OverrideRepository repository) { Iterator<?> iterator = tables.iterator(); while ( iterator.hasNext() ) { Element element = (Element) iterator.next(); Table table = new Table(); table.setCatalog( element.attributeValue("catalog") ); table.setSchema( element.attributeValue("schema") ); table.setName( element.attributeValue("name") ); String wantedClassName = element.attributeValue("class"); Element primaryKey = element.element("primary-key"); bindPrimaryKey(primaryKey, table, repository); List<?> columns = element.elements("column"); bindColumns(columns, table, repository); List<?> foreignKeys = element.elements("foreign-key"); bindForeignKeys(foreignKeys, table, repository); bindMetaAttributes(element, table, repository); repository.addTable(table,wantedClassName); } }
Table foreignTable = new Table(); foreignTable.setName(foreignTableName); foreignTable.setCatalog(getValue(element.attributeValue( "foreign-catalog"), table.getCatalog()) ); foreignTable.setSchema(getValue(element.attributeValue( "foreign-schema"), table.getSchema()) );
public Table addTable(String schema, String catalog, String name) { String key = TableNameQualifier.qualify(quote(catalog), quote(schema), quote(name)); Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(false); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); tables.put(key, table); String qualifier = StringHelper.qualifier(key); List<Table> schemaList = qualifiers.get(qualifier); if(schemaList==null) { schemaList = new ArrayList<Table>(); qualifiers.put(qualifier, schemaList); } schemaList.add(table); } else { table.setAbstract(false); } return table; }
public Table addTable(String schema, String catalog, String name) { String key = TableNameQualifier.qualify(quote(catalog), quote(schema), quote(name)); Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(false); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); tables.put(key, table); String qualifier = StringHelper.qualifier(key); List<Table> schemaList = qualifiers.get(qualifier); if(schemaList==null) { schemaList = new ArrayList<Table>(); qualifiers.put(qualifier, schemaList); } schemaList.add(table); } else { table.setAbstract(false); } return table; }
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws MappingException { String key = subselect==null ? Table.qualify(catalog, schema, name, '.') : subselect; if ( tables.containsKey(key) ) { throw new MappingException("duplicate table: " + name); } Table table = new DenormalizedTable(includedTable); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); return table; }
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws MappingException { String key = subselect==null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey(key) ) { throw new DuplicateMappingException("table", name); } Table table = new DenormalizedTable(includedTable); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); return table; }
public Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract ) { String key = subselect==null ? Table.qualify(catalog, schema, name, '.') : subselect; Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); } else { if (!isAbstract) table.setAbstract(false); } return table; }
public Table addTable(String schema, String catalog, String name, String subselect, boolean isAbstract ) { String key = subselect==null ? Table.qualify(catalog, schema, name) : subselect; Table table = (Table) tables.get(key); if (table == null) { table = new Table(); table.setAbstract(isAbstract); table.setName(name); table.setSchema(schema); table.setCatalog(catalog); table.setSubselect(subselect); tables.put(key, table); } else { if (!isAbstract) table.setAbstract(false); } return table; }
Table foreignTable = new Table(); foreignTable.setName(foreignTableName); foreignTable.setCatalog( element.hasAttribute("foreign-catalog") ? element.getAttribute("foreign-catalog") :
foreignTable.setCatalog(getValue(element.attributeValue( "foreign-catalog"),table.getCatalog()) ); foreignTable.setSchema(getValue(element.attributeValue( "foreign-schema"), table.getSchema()) );
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws DuplicateMappingException { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey( key ) ) { throw new DuplicateMappingException( "table", name ); } Table table = new DenormalizedTable( includedTable ); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); return table; }
public Table addDenormalizedTable( String schema, String catalog, String name, boolean isAbstract, String subselect, Table includedTable) throws DuplicateMappingException { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect; if ( tables.containsKey( key ) ) { throw new DuplicateMappingException( "table", name ); } Table table = new DenormalizedTable( includedTable ); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); return table; }
private static void bindTables( ArrayList<Element> tables, OverrideRepository repository) { for (Element element : tables) { Table table = new Table(); table.setCatalog(getAttribute(element, "catalog")); table.setSchema(getAttribute(element, "schema")); table.setName(getAttribute(element, "name")); ArrayList<Element> primaryKeys = getChildElements(element, "primary-key"); if (primaryKeys.size() > 0) { bindPrimaryKey(primaryKeys.get(0), table, repository); } bindColumns(getChildElements(element, "column"), table, repository); bindForeignKeys(getChildElements(element, "foreign-key"), table, repository); bindMetaAttributes(element, table, repository); repository.addTable(table, getAttribute(element, "class")); } }
public Table addTable( String schema, String catalog, String name, String subselect, boolean isAbstract) { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect; Table table = tables.get( key ); if ( table == null ) { table = new Table(); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); } else { if ( !isAbstract ) { table.setAbstract( false ); } } return table; }
public Table addTable( String schema, String catalog, String name, String subselect, boolean isAbstract) { name = getObjectNameNormalizer().normalizeIdentifierQuoting( name ); schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema ); catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog ); String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect; Table table = tables.get( key ); if ( table == null ) { table = new Table(); table.setAbstract( isAbstract ); table.setName( name ); table.setSchema( schema ); table.setCatalog( catalog ); table.setSubselect( subselect ); tables.put( key, table ); } else { if ( !isAbstract ) { table.setAbstract( false ); } } return table; }
Table table = iter.next(); if (table.getCatalog() != null && table.getCatalog().equals(defaultCatalog)) { table.setCatalog(null);
Table table = iter.next(); if (table.getCatalog() != null && table.getCatalog().equals(defaultCatalog)) { table.setCatalog(null);
public boolean isTable(Object key) throws HibernateException { if(key instanceof String) { Table tbl = new Table((String)key); if ( getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null ) { return true; } else { String[] strings = StringHelper.split(".", (String) key); if(strings.length==3) { tbl = new Table(strings[2]); tbl.setCatalog(strings[0]); tbl.setSchema(strings[1]); return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null; } else if (strings.length==2) { tbl = new Table(strings[1]); tbl.setSchema(strings[0]); return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null; } } } return false; }
public boolean isTable(Object key) throws HibernateException { if(key instanceof String) { Table tbl = new Table((String)key); if ( getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null ) { return true; } else { String[] strings = StringHelper.split(".", (String) key); if(strings.length==3) { tbl = new Table(strings[2]); tbl.setCatalog(strings[0]); tbl.setSchema(strings[1]); return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null; } else if (strings.length==2) { tbl = new Table(strings[1]); tbl.setSchema(strings[0]); return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null; } } } return false; }
if (strings.length == 3) { tbl = new Table(strings[2]); tbl.setCatalog(strings[0]); tbl.setSchema(strings[1]); return getTableMetadata(