/** * Writes to *.dbschema file from schema * @param schema a SchemaElement * @param filePath a directory where *.dbschema is located * @throws IOException */ private static void writeSchemaFile(SchemaElement schema, File filePath) throws IOException { OutputStream schemaStream = null; try { schemaStream = new FileOutputStream( new File(filePath, NameUtil.getSchemaResourceName( schema.getName().getName()))); schema.save(schemaStream); } catch (IOException ex) { throw ex; } finally { try { if (schemaStream != null) { schemaStream.close(); } } catch (IOException ex) { if (logger.isLoggable(Logger.FINE)) logger.fine(ex.toString()); } } }
dbVendorName); DDLTemplateFormatter.reset(mappingPolicy); String schemaName = schema.getName().getName(); List createAllTblDDL = new ArrayList();
/** Set the database root for this MappingClassElement. * The root represents the database used by the tables mapped to * this mapping class. * @param root the new database root * @exception ModelException if impossible */ public void setDatabaseRoot (SchemaElement root) throws ModelException { String old = getDatabaseRoot(); String newRoot = ((root != null) ? root.getName().getFullName() : null); try { fireVetoableChange(PROP_DATABASE_ROOT, old, newRoot); _databaseRoot = newRoot; firePropertyChange(PROP_DATABASE_ROOT, old, newRoot); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
/** Set the database root for this MappingClassElement. * The root represents the database used by the tables mapped to * this mapping class. * @param root the new database root * @exception ModelException if impossible */ public void setDatabaseRoot (SchemaElement root) throws ModelException { String old = getDatabaseRoot(); String newRoot = ((root != null) ? root.getName().getFullName() : null); try { fireVetoableChange(PROP_DATABASE_ROOT, old, newRoot); _databaseRoot = newRoot; firePropertyChange(PROP_DATABASE_ROOT, old, newRoot); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
/** * Create table and add to schema. * @param schema Schema to which the table gets attached. * @param tableName Name of the table without the schema name. * @return TableElement for this table name * @throws DBException */ static TableElement createAndAttachTable(SchemaElement schema, String tableName) throws DBException { String fullName = NameUtil.getAbsoluteTableName( schema.getName().getName(), tableName); TableElementImpl tableImpl = new TableElementImpl(tableName); TableElement table = new TableElement(tableImpl, schema); table.setName(DBIdentifier.create(fullName)); table.setTableOrView(true); schema.addTable(table); return table; }
SchemaElement.removeFromCache(schema.getName().getName());
else if (!currentRoot.equals(schema.getName().getFullName()))
else if (!currentRoot.equals(schema.getName().getFullName()))