public static String[] getTableNames() { List<String> tableNames = new ArrayList<String>(); Configuration cfg = createConfiguration(new Properties()); Iterator<PersistentClass> classMappings = cfg.getClassMappings(); while (classMappings.hasNext()) { PersistentClass o = classMappings.next(); tableNames.add(o.getTable().getName()); } return tableNames.toArray(new String[tableNames.size()]); }
public static String[] getTableNames() { List<String> tableNames = new ArrayList<String>(); Configuration cfg = createConfiguration(new Properties()); Iterator<PersistentClass> classMappings = cfg.getClassMappings(); while (classMappings.hasNext()) { PersistentClass o = classMappings.next(); tableNames.add(o.getTable().getName()); } return tableNames.toArray(new String[tableNames.size()]); }
/** * Generates the DDL schema * @param dialect the dialect to use (complete class name for the hibernate dialect object) * @return an array containing the SQL statements */ public static String[] generateCreateSchemaDDL(String dialect) { Properties props = new Properties(); props.put(Environment.DIALECT, dialect); Configuration cfg = createConfiguration(props); String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props)); addDelimiters(sqls); return sqls; }
/** * Generates the DDL schema * @param dialect the dialect to use (complete class name for the hibernate dialect object) * @return an array containing the SQL statements */ public static String[] generateCreateSchemaDDL(String dialect) { Properties props = new Properties(); props.put(Environment.DIALECT, dialect); Configuration cfg = createConfiguration(props); String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props)); addDelimiters(sqls); return sqls; }
/** * Generates the DDL schema * @param dialect the dialect to use (complete class name for the hibernate dialect object) * @return an array containing the SQL statements */ public static String[] generateDropSchemaDDL(String dialect) { Properties props = new Properties(); props.put(Environment.DIALECT, dialect); Configuration cfg = createConfiguration(props); String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props)); addDelimiters(sqls); return sqls; }
/** * Generates the DDL schema * @param dialect the dialect to use (complete class name for the hibernate dialect object) * @return an array containing the SQL statements */ public static String[] generateDropSchemaDDL(String dialect) { Properties props = new Properties(); props.put(Environment.DIALECT, dialect); Configuration cfg = createConfiguration(props); String[] sqls = cfg.generateSchemaCreationScript(Dialect.getDialect(props)); addDelimiters(sqls); return sqls; }
public static String[] generateUpdateSchemaDDL(String dialect, Connection connection) throws SQLException { Properties props = new Properties(); props.put(Environment.DIALECT, dialect); Configuration cfg = createConfiguration(props); final Dialect dialectObj = Dialect.getDialect(props); String[] sqls = cfg.generateSchemaUpdateScript(dialectObj, new DatabaseMetadata(connection, dialectObj) ); addDelimiters(sqls); return sqls; }
public static String[] generateUpdateSchemaDDL(String dialect, Connection connection) throws SQLException { Properties props = new Properties(); props.put(Environment.DIALECT, dialect); Configuration cfg = createConfiguration(props); final Dialect dialectObj = Dialect.getDialect(props); String[] sqls = cfg.generateSchemaUpdateScript(dialectObj, new DatabaseMetadata(connection, dialectObj) ); addDelimiters(sqls); return sqls; }