/** * Drops and creates the schema. Beware that it commits transactions * @param initializeDatabase If false, do not initialize the database (e.g. don't create Institution) */ public static void resetSchema(boolean initializeDatabase) throws IntactTransactionException { if (log.isDebugEnabled()) log.debug("Resetting schema"); dropSchema(); createSchema(initializeDatabase); } }
/** * Generates the DDL schema for PostgreSQL. * @return an array containing the SQL statements */ public static String[] generateCreateSchemaDDLForPostgreSQL() { return generateCreateSchemaDDL(PostgreSQLDialect.class.getName()); }
/** * Generates the DDL schema for Oracle * @return an array containing the SQL statements */ public static String[] generateDropSchemaDDLForOracle() { return generateDropSchemaDDL(Oracle9Dialect.class.getName()); }
/** * 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; }
/** * Drops and creates the schema, initializing intact. Beware that it commits transactions */ public static void resetSchema() throws IntactTransactionException { resetSchema(true); }
/** * Creates a schema and initialize the database */ public static void createSchema() throws IntactTransactionException { createSchema(true); }
/** * Generates the UPDATE DDL schema for PostgreSQL . * @return an array containing the SQL statements */ public static String[] generateUpdateSchemaDDLForPostgreSQL(Connection connection) throws SQLException { return generateUpdateSchemaDDL(PostgreSQLDialect.class.getName(), connection); }
/** * Drops the current schema, emptying the database */ public void dropSchema() throws IntactTransactionException { SchemaUtils.dropSchema(); }
/** * Drops the current schema, emptying the database */ public static void dropSchema() { if (log.isDebugEnabled()) log.debug("Droping schema"); SchemaExport se = newSchemaExport(); se.drop(false, true); }
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[] 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; }
/** * Drops and creates the schema, initializing intact. Beware that it commits transactions */ public static void resetSchema() throws IntactTransactionException { resetSchema(true); }
/** * Creates a schema * @param initializeDatabase If false, do not initialize the database (e.g. don't create Institution) */ public void createSchema(boolean initializeDatabase) throws IntactTransactionException { SchemaUtils.createSchema(initializeDatabase); }
/** * Generates the UPDATE DDL schema for HSQL . * @return an array containing the SQL statements */ public static String[] generateUpdateSchemaDDLForHSQL(Connection connection) throws SQLException { return generateUpdateSchemaDDL(HSQLDialect.class.getName(), connection); }
/** * Drops the current schema, emptying the database */ public static void dropSchema() { if (log.isDebugEnabled()) log.debug("Droping schema"); SchemaExport se = newSchemaExport(); se.drop(false, true); }
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()]); }
/** * Drops and creates the schema. Beware that it commits transactions * @param initializeDatabase If false, do not initialize the database (e.g. don't create Institution) */ public static void resetSchema(boolean initializeDatabase) throws IntactTransactionException { if (log.isDebugEnabled()) log.debug("Resetting schema"); dropSchema(); createSchema(initializeDatabase); } }
/** * 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 for HSQL DB. * @return an array containing the SQL statements */ public static String[] generateCreateSchemaDDLForHSQL() { return generateCreateSchemaDDL(HSQLDialect.class.getName()); }
/** * Generates the DDL schema for Oracle * @return an array containing the SQL statements */ public static String[] generateDropSchemaDDLForOracle() { return generateDropSchemaDDL(Oracle9iDialect.class.getName()); }