Example usage for org.springframework.jdbc.core JdbcTemplate JdbcTemplate

List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate

Introduction

In this page you can find the example usage for org.springframework.jdbc.core JdbcTemplate JdbcTemplate.

Prototype

public JdbcTemplate(DataSource dataSource) 

Source Link

Document

Construct a new JdbcTemplate, given a DataSource to obtain connections from.

Usage

From source file:com.grayfox.server.dao.jdbc.JdbcDao.java

@PostConstruct
private void onPostConstruct() {
    jdbcTemplate = new JdbcTemplate(dataSource);
}

From source file:be.jacobsvanroy.springsqlunit.IntegrationTest.java

public static Long getCount() {
    return new JdbcTemplate(DATA_SOURCE).queryForObject("select count(*) from spring_sql_test", Long.class);
}

From source file:de.drv.dsrv.spoc.dao.SpocConfigDAOImpl.java

public SpocConfigDAOImpl(final DataSource dataSource, final String schemaName) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
    this.selectSql = "SELECT EXTRA_PROCEDURE, EXTRA_DATATYPE, EXTRA_PROFILE, EXTRA_VERSION, STARTURL FROM "
            + schemaName/*w ww .  jav a  2s. c om*/
            + ".CONFIG WHERE EXTRA_PROCEDURE = ? AND EXTRA_DATATYPE = ? AND EXTRA_PROFILE = ? AND EXTRA_VERSION = ?";
}

From source file:org.wso2.carbon.metrics.reporter.JDBCReporterTest.java

@BeforeClass
public static void setupDatasource() throws Exception {
    dataSource = JdbcConnectionPool.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "");
    template = new JdbcTemplate(dataSource);
    ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
    populator.addScript(new ClassPathResource("dbscripts/h2.sql"));
    populator.populate(dataSource.getConnection());
}

From source file:io.spring.marchmadness.BeforeJobNotification.java

@Override
public void beforeJob(JobExecution jobExecution) {
    JdbcTemplate template = new JdbcTemplate(dataSource.get(0));
    getYearFromData();//from w  ww  .ja v  a 2s.  co  m
    template.execute("delete from NCAA_STATS where year = " + getYearFromData());
}

From source file:io.spring.marchmadness.BeforeMooreJobNotification.java

@Override
public void beforeJob(JobExecution jobExecution) {
    JdbcTemplate template = new JdbcTemplate(dataSource.get(0));
    template.execute("delete from MOORE_NCAA_STATS where year = " + getYearFromData());
}

From source file:com.dai.dao.CompeticaoDaoImpl.java

@Override
public List<Competicao> listaCompeticao() {

    List<Competicao> slList = new ArrayList();

    String sql = "select * from competicao";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    slList = jdbcTemplate.query(sql, new CompeticaoRowMapper());
    return slList;
}

From source file:com.jaxio.celerio.configuration.database.mysql.MysqlExtension.java

protected JdbcTemplate getJdbcTemplate(Connection connection) {
    DataSource dataSource = new SingleConnectionDataSource(connection, true);
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    return jdbcTemplate;
}

From source file:com.recber.dao.UserDaoImpl.java

@Override
public void deleteData(String id) {
    String sql = "delete from user where user_id=" + id;
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update(sql);/*from w  w w.  j  a  v  a  2s  .  c o m*/

}

From source file:id.co.teleanjar.ppobws.jatelindo.ServiceJatelindoJDBC.java

private JdbcTemplate getJdbcTemplate() {
    return new JdbcTemplate(this.datasource);
}