/** * Execute the given SQL script. * <p>The script will typically be loaded from the classpath. There should * be one statement per line. Any semicolons and line comments will be removed. * <p><b>Do not use this method to execute DDL if you expect rollback.</b> * @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations * @param resourceLoader the resource loader with which to load the SQL script * @param sqlResourcePath the Spring resource path for the SQL script * @param continueOnError whether or not to continue without throwing an * exception in the event of an error * @throws DataAccessException if there is an error executing a statement * and {@code continueOnError} is {@code false} * @see ResourceDatabasePopulator * @see #executeSqlScript(JdbcTemplate, Resource, boolean) * @deprecated as of Spring 4.0.3, in favor of using * {@link org.springframework.jdbc.datasource.init.ScriptUtils#executeSqlScript} * or {@link org.springframework.jdbc.datasource.init.ResourceDatabasePopulator}. */ @Deprecated public static void executeSqlScript(JdbcTemplate jdbcTemplate, ResourceLoader resourceLoader, String sqlResourcePath, boolean continueOnError) throws DataAccessException { Resource resource = resourceLoader.getResource(sqlResourcePath); executeSqlScript(jdbcTemplate, resource, continueOnError); }
/** * Execute the given SQL script. * <p>The script will typically be loaded from the classpath. Statements * should be delimited with a semicolon. If statements are not delimited with * a semicolon then there should be one statement per line. Statements are * allowed to span lines only if they are delimited with a semicolon. Any * line comments will be removed. * <p><b>Do not use this method to execute DDL if you expect rollback.</b> * @param jdbcTemplate the JdbcTemplate with which to perform JDBC operations * @param resource the resource to load the SQL script from * @param continueOnError whether or not to continue without throwing an * exception in the event of an error * @throws DataAccessException if there is an error executing a statement * and {@code continueOnError} is {@code false} * @see ResourceDatabasePopulator * @see #executeSqlScript(JdbcTemplate, EncodedResource, boolean) * @deprecated as of Spring 4.0.3, in favor of using * {@link org.springframework.jdbc.datasource.init.ScriptUtils#executeSqlScript} * or {@link org.springframework.jdbc.datasource.init.ResourceDatabasePopulator}. */ @Deprecated public static void executeSqlScript(JdbcTemplate jdbcTemplate, Resource resource, boolean continueOnError) throws DataAccessException { executeSqlScript(jdbcTemplate, new EncodedResource(resource), continueOnError); }