@Test public void testLoadDBSchema() throws DataAccessException, FileNotFoundException { dbUtil.loadDBSchema(dataSource, "sqlmap/schema.sql"); }
public void loadDBSchema(DataSource dataSource, String schemaName) throws DataAccessException, FileNotFoundException { JdbcTemplate template = new JdbcTemplate(dataSource); InputStream is = null; try { is = new ClassPathResource(schemaName).getInputStream(); contents = IOUtils.toString(is); } catch (IOException e) { throw new FileNotFoundException("schema[" + schemaName + "]" + "is not found"); } template.execute(new StatementCallback<Boolean>() { @Override public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessException { return stmt.execute(contents); } }); }
DBUtil { public void loadDBSchema(DataSource dataSource, String schemaName) throws DataAccessException, FileNotFoundException { JdbcTemplate template = new JdbcTemplate(dataSource); InputStream is = null; try { is = new ClassPathResource(schemaName).getInputStream(); contents = IOUtils.toString(is); } catch (IOException e) { throw new FileNotFoundException("schema[" + schemaName + "]" + "is not found"); } template.execute(new StatementCallback<Boolean>() { @Override public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessException { return stmt.execute(contents); } }); } }
DBUtil { public void loadDBSchema(DataSource dataSource, String schemaName) throws DataAccessException, FileNotFoundException { JdbcTemplate template = new JdbcTemplate(dataSource); InputStream is = null; try { is = new ClassPathResource(schemaName).getInputStream(); contents = IOUtils.toString(is); } catch (IOException e) { throw new FileNotFoundException("schema[" + schemaName + "]" + "is not found"); } template.execute(new StatementCallback<Boolean>() { @Override public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessException { return stmt.execute(contents); } }); }  }
DBUtil { public void loadDBSchema(DataSource dataSource, String schemaName) throws DataAccessException, FileNotFoundException { JdbcTemplate template = new JdbcTemplate(dataSource); InputStream is = null; try { is = new ClassPathResource(schemaName).getInputStream(); contents = IOUtils.toString(is); } catch (IOException e) { throw new FileNotFoundException("schema[" + schemaName + "]" + "is not found"); } template.execute(new StatementCallback<Boolean>() { @Override public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessException { return stmt.execute(contents); } }); }  void loadDBSchema(DataSource dataSource, String schemaName); }
DBUtil { public void loadDBSchema(DataSource dataSource, String schemaName) throws DataAccessException, FileNotFoundException { JdbcTemplate template = new JdbcTemplate(dataSource); InputStream is = null; try { is = new ClassPathResource(schemaName).getInputStream(); contents = IOUtils.toString(is); } catch (IOException e) { throw new FileNotFoundException("schema[" + schemaName + "]" + "is not found"); } template.execute(new StatementCallback<Boolean>() { @Override public Boolean doInStatement(Statement stmt) throws SQLException, DataAccessException { return stmt.execute(contents); } }); }  void loadDBSchema(DataSource dataSource, String schemaName);  }