Spring Framework ResourceDatabasePopulator - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ResourceDatabasePopulator class.

This code example shows how to use the following methods:addScript, populate, setContinueOnError, setIgnoreFailedDrops
        this.type = type;
    } 
 
    @Override 
    public void migrate(Connection connection) throws Exception {
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
        populator.addScript(new ClassPathResource("org/cloudfoundry/identity/uaa/db/" + type
                        + "/V1_5_2__initial_db.sql")); 
        populator.setContinueOnError(true);
        populator.setIgnoreFailedDrops(true);
        populator.populate(connection);
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate
    } 
 
    @Bean 
    @DependsOn("entityManagerFactory") 
    public ResourceDatabasePopulator initDatabase(DataSource dataSource) throws Exception { 
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); 
        populator.addScript(new ClassPathResource("data.sql")); 
        populator.populate(dataSource.getConnection()); 
        return populator; 
    } 
 
    @Bean 
    public PlatformTransactionManager transactionManager() { 
        JpaTransactionManager txManager = new JpaTransactionManager(); 
        txManager.setEntityManagerFactory(entityManagerFactory().getObject()); 
        return txManager; 
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate
    } 
 
    @Bean 
    @DependsOn("entityManagerFactory") 
    public ResourceDatabasePopulator initDatabase(DataSource dataSource) throws Exception { 
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); 
        populator.addScript(new ClassPathResource("data.sql")); 
        populator.populate(dataSource.getConnection()); 
        return populator; 
    } 
 
    @Bean 
    public PlatformTransactionManager transactionManager() { 
        JpaTransactionManager txManager = new JpaTransactionManager(); 
        txManager.setEntityManagerFactory(entityManagerFactory().getObject()); 
        return txManager; 
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript
This code example shows how to use the following methods:addScript, populate, setContinueOnError, setIgnoreFailedDrops
        return H2Dialect.class;
    } 
 
    @Bean 
    public DatabasePopulator databasePopulator(DataSource dataSource) {
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
        populator.setContinueOnError(true);
        populator.setIgnoreFailedDrops(true);
        populator.addScript(new ClassPathResource("/sql/items.sql"));
        try { 
            populator.populate(dataSource.getConnection());
        } catch (SQLException e) {
            logger.error("Exception Populating Database", e);
        } 
        return populator;
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate
	 * @throws SQLException 
	 */ 
	@Before 
	public void populateDatabase() throws SQLException {
 
		ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
		populator.addScript(new ClassPathResource("data.sql"));
 
		Connection connection = null;
 
		try { 
			connection = DataSourceUtils.getConnection(dataSource);
			populator.populate(connection);
		} finally { 
			if (connection != null) {
				DataSourceUtils.releaseConnection(connection, dataSource);
			} 
		} 
	} 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate, setContinueOnError, setIgnoreFailedDrops
        return DerbyTenFiveDialect.class;
    } 
 
    @Bean 
    public DatabasePopulator databasePopulator(DataSource dataSource) {
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
        populator.setContinueOnError(true);
        populator.setIgnoreFailedDrops(true);
        populator.addScript(new ClassPathResource("/sql/items.sql"));
        try { 
            populator.populate(dataSource.getConnection());
        } catch (SQLException e) {
            logger.error("Exception Populating Database", e);
        } 
        return populator;
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate
    private static Environment environment = TestProfileEnvironment.getEnvironment();
 
    private static String platform = environment.acceptsProfiles("postgresql") ? "postgresql" : "hsqldb";
 
    public static void runScript(DataSource dataSource, String stem) throws Exception {
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
        String packageName = ClassUtils.getPackageName(TestUtils.class).replace(".", "/");
        populator.addScript(new ClassPathResource(packageName.substring(0, packageName.lastIndexOf("/")) + "/" + stem
                        + "-" + platform + ".sql"));
        Connection connection = dataSource.getConnection();
        try { 
            populator.populate(connection);
        } catch (ScriptStatementFailedException e) {
            // ignore 
        } finally { 
            DataSourceUtils.releaseConnection(connection, dataSource);
        } 
    } 
 
    public static void createSchema(DataSource dataSource) throws Exception {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate, setContinueOnError, setIgnoreFailedDrops
        return HSQLDialect.class;
    } 
 
    @Bean 
    public DatabasePopulator databasePopulator(DataSource dataSource) {
        ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
        populator.setContinueOnError(true);
        populator.setIgnoreFailedDrops(true);
        populator.addScript(new ClassPathResource("/sql/items.sql"));
        try { 
            populator.populate(dataSource.getConnection());
        } catch (SQLException e) {
            logger.error("Exception Populating Database", e);
        } 
        return populator;
    } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:addScript, populate
See Code Examples for Spring Framework ResourceDatabasePopulator Methods: